YAML Validation Errors
These errors appear when validating or parsing YAML configuration files, particularly in the Converter and Developer Mode.
Error Patterns
Bad Indentation
Message: “The file has a formatting error: indentation (spaces at the beginning of the line) is incorrect.”
Cause: YAML uses spaces for indentation, and they must be consistent.
Bad example:
items:
my_item:
display_name: "Sword"
material: PAPER # Wrong! Inconsistent indentationFixed:
items:
my_item:
display_name: "Sword"
material: PAPERRule: Use 2 spaces per indentation level. Never mix tabs and spaces.
Unexpected End of File
Message: “The file is incomplete. Verify that all sections are properly closed.”
Cause: The YAML file is cut off or missing closing elements.
Bad example:
items:
my_item:
display_name: "Sword"
material:Fixed:
items:
my_item:
display_name: "Sword"
material: PAPERDuplicate Key
Message: “The file has duplicate keys. Each property name must be unique in its section.”
Cause: The same key appears twice at the same level.
Bad example:
items:
my_item:
display_name: "Sword"
material: PAPER
display_name: "Better Sword" # Duplicate!Fixed:
items:
my_item:
display_name: "Better Sword"
material: PAPERUnexpected Token
Message: “The file has an unexpected character. Check the file syntax.”
Cause: A character appeared where YAML didn’t expect it.
Common causes:
- Unquoted strings starting with special characters (
{,[,*,&,!,%,@) - Missing colon after a key
- Missing space after the colon
Bad example:
items:
my_item:
display_name:Sword # Missing space after colonFixed:
items:
my_item:
display_name: SwordInvalid Tag
Message: “The file contains an invalid YAML tag.”
Cause: An unrecognized YAML tag was used (e.g., !!python/object).
Solution: Remove any YAML tags that start with ! unless they are specifically required by your plugin.
Mapping Values Not Allowed
Message: “The file has a structure error. Verify that values are correctly assigned with ’:’.”
Cause: A value was placed where a mapping key was expected.
Bad example:
items:
my_item:
display_name: "My Item"
material: PAPER # Wrong level — should be inside my_itemFixed:
items:
my_item:
display_name: "My Item"
material: PAPERIncomplete Key-Value Pair
Message: “The file has an incomplete property. Make sure each key has an assigned value.”
Cause: A key exists without a value, and YAML can’t infer what it should be.
Bad example:
items:
my_item:
display_name:
material: PAPERFixed:
items:
my_item:
display_name: "My Item"
material: PAPERTab Character
Message: “The file uses tabs instead of spaces. YAML only allows spaces for indentation.”
Cause: Tab characters (\t) were used for indentation.
Solution:
- Configure your text editor to use spaces instead of tabs
- In VS Code: Settings > Editor: Insert Spaces = true, Tab Size = 2
- Use “Convert Indentation to Spaces” command in your editor
Empty File
Message: “The file is empty. Upload a YAML file with valid content.”
Solution: Make sure the file you’re uploading actually contains YAML content and isn’t a 0-byte file.
Tips for Writing Valid YAML
- Always use spaces (2 per level), never tabs
- Quote strings that contain special characters:
display_name: "Item: Special" - Validate before uploading using the Developer Mode editor, which provides real-time feedback
- Use a YAML-aware editor like VS Code with the YAML extension