Fix "Non [a-z0-9/._-] character in path of location"
Every id in Minecraft, such as examplemod:ruby_sword, is a resource location: a namespace (your mod id), a colon and
a path. Both parts may only use lower-case letters, digits and _ - ., and the path may also use /. A capital
letter or a space anywhere stops the game with:
Non [a-z0-9/._-] character in path of location: examplemod:Ruby_SwordThe same rule applies to the namespace, so a mod id with a capital letter fails too.
When the bad id is registered in a static field, the message sits under another error. On NeoForge 1.21.1 the log shows:
Failed to create mod instance. ModID: examplemod, class com.example.examplemod.ExampleModjava.lang.ExceptionInInitializerError: null at com.example.examplemod.ExampleMod.<init>(ExampleMod.java:25)Caused by: net.minecraft.ResourceLocationException: Non [a-z0-9/._-] character in path of location: examplemod:Ruby_Sword at net.minecraft.resources.ResourceLocation.assertValidPath(ResourceLocation.java:311) ... at com.example.examplemod.registry.ModItems.<clinit>(ModItems.java:16)The last line in your own package, ModItems.java:16 here, is the registration to fix.
Checked on 19 November 2026 on a NeoForge 1.21.1 server, with an item registered as "Ruby_Sword". The log above is
shortened.
Where the bad name usually is
Section titled “Where the bad name usually is”- A registry id in code:
"Ruby_Sword"instead of"ruby_sword"when registering a block or item. - A file name:
Ruby.png,RubyBlock.jsonorruby sword.json. Models, textures, blockstates, recipes and loot tables are found by their file names, so their names become ids. - A reference inside JSON: a model that points at
examplemod:item/Ruby, or a recipe withExamplemod:ruby. - The mod id itself in
fabric.mod.jsonorneoforge.mods.toml.
The id after location: in the message is the one to fix.
Rename it to lower case with underscores (ruby_sword), then change every place that refers to it: the registration,
the JSON files that point at it and the language file keys (item.examplemod.ruby_sword). On Windows a rename that
only changes upper to lower case can be missed by Git; rename to a temporary name first, then to the final one.
In Linen
Section titled “In Linen”Crash Doctor in Linen reads the crash report and the log next to it, then names the mod, the line and what to change. It’s free. Fix an item name that shows as item.modid.name covers the language file side.