I don't think that can be caused by bad state. The engine only errors about duplicate resources for when the same name is registered twice by the program, so I'd guess you must have introduced a bug in your program where your now trying to create the same resource twice, or two different resources but with the same name.
Often the later is due to component resources, names are globally unique, not unique per-parent so component resources generally have to prepend their name to the child resources names to keep everything unique.