Errors. Too erroneous for my liking.📎
Errors! Disgusting little beasts, but helpful. Sometimes. Hopefully, you'll never need to read this page, as you should know enough to write perfect YAML with ease! But, this information, as always, is good to know for that "just in case" scenario. To help you learn all about YAML errors, we're going to be using a useful tool. I recommend you have this YAML validator open as we go along this lesson. Don't worry, it's completely safe.
Take a look at the small (fake) configuration file below:
section: #Line 1
lore: #Line 2
- 'Hello there!' #Line 3
- 'What''s this?' #Line 4
Can you spot what's wrong with this file? A YAML validator sure can! A YAML validator is very useful in the case where your configuration file could be thousands of lines long. This will help you pinpoint issues with your file much quicker. Now, take a look at the YAML error that is returned when you throw this file into it:
ERROR:
while parsing a block collection
in "<unicode string>", line 3, column 5:
- 'Hello!'
^
expected <block end>, but found '<block sequence start>'
in "<unicode string>", line 4, column 6:
- 'E'
^
Tip: Sometimes, a YAML file may be so badly riddled with errors that, when you fix one, you end up causing five different errors. If you ever reach this stage, it may be best to start over. The number one culprit for a file reaching this stage is people copying and pasting repeated sections over and over to make life quicker for them, without paying attention to the formatting itself. Keep in mind that copying and pasting will normally mess up your formatting. If you choose to do this, it's best you do so while checking and correcting the section you've pasted in before copying and pasting again.
Please note that some information may be wrong in this wiki, and I have done my best to ensure whatever has been written is correct. This was written in British English (with the odd oxford comma). If you believe there is a spelling, grammatical, or technical error, please contact me immediately through Discord: longbow122#1576