What the validator treats as an error
INI has no formal specification, so the validator accepts the broad dialect most programs share and rejects only lines that no common parser can read:
- A section header without its closing bracket, such as
[database. Everything below it would otherwise land in the wrong section. - Text after a header, as in
[server] port = 8080. Keys must start on their own line. - A line that is not a key, a section or a comment.
port 8080has a space but no=or:, so it cannot be split into a key and a value. - A separator with no key in front of it, like
= production.
Bare words without spaces, such as MySQL’s skip-name-resolve, are valid flags, not errors. Indented lines under a key are read as continuation lines. Comments may start with ; or #.
Files saved by Windows tools rarely cause trouble here: CRLF line endings are read normally, and a UTF-8 byte-order mark added by Notepad is removed with an informational note rather than being glued to the first section name, which is a classic cause of “section not found” bugs in hand-written parsers.
Warnings for duplicates
A repeated key in the same section is reported as a warning with the line of the first definition. So is a section header that appears twice. They are not errors because the consequences depend on the reader: PHP and the Windows profile API keep one value, Python’s configparser raises DuplicateOptionError in strict mode (its default), and git treats a repeated key as a multi-valued setting on purpose. Key comparison ignores case, so Port and port count as the same key, which is how configparser and Windows see them.
When an error is found, its line is highlighted and the message explains it (“Line 2 is not a section, key or comment”) along with a short hint. The output pane does not go blank; it keeps the most recent valid formatting, shown dimmed, so you can see the structure you had before the change.
Limits of a generic INI check
Because INI is a family of dialects, some program-specific rules are out of scope. The validator does not know which keys PHP, MySQL or systemd accept, so memory_limt = 256M passes. It does not interpret values: On, 1 and yes are all just text. Keys before the first section header are accepted, although Python’s configparser rejects them with MissingSectionHeaderError. Interpolation syntax such as %(home)s or ${section:key} is left unexamined.
Validation is done locally in the browser, so a my.cnf with a root password or a .pypirc with an upload token is never transmitted. To tidy the file after it passes, use the INI formatter, which aligns separators and keeps every comment.
Examples
Header missing its bracket
Invalid: the [database header is not closed, so the validator stops on line 1 and suggests adding ‘]’.
[database
host = db.internal
port = 5432
Line 1, column 1: Unclosed '[' in section header on line 1Key without a separator
Invalid: port 8080 contains a space but no = or :, so it is neither a key-value pair nor a bare flag.
[server]
host = 0.0.0.0
port 8080
workers = 4
Line 3, column 1: Line 3 is not a section, key or commentDuplicate key with different case
The file is valid, but Port on line 4 is flagged as a duplicate of port on line 2 because keys are compared case-insensitively.
[server]
port = 8080
host = 0.0.0.0
Port = 9090
[server]
port = 8080
host = 0.0.0.0
Port = 9090
Common errors and how to fix them
| Error | Cause | Fix |
|---|---|---|
Unclosed '[' in section header on line 1 | The closing ] of a section name is missing. | Add ] at the end of the header. |
Line 3 is not a section, key or comment | The line has words separated by spaces but no = or : between key and value. | Insert = between the key and the value, or comment the line out with ; or #. |
Unexpected text 'port = 8080' after section header on line 1 | A key was placed on the same line as the section header. | Move the key to the next line. |
Missing key name before '=' on line 1 | The line starts with the separator, so the key is empty. | Add the key name before =. |
Duplicate section [server] (first defined on line 1) | The same section header appears twice; some parsers merge the two, others keep only one. | Combine both sections into one. |
Frequently asked questions
Which INI dialect does the validator use?
A permissive common dialect: [sections], key = value or key: value, ; and # comments, bare flags and indented continuation lines. That covers php.ini, my.cnf, .gitconfig, setup.cfg, tox.ini and .desktop files.
Is a key outside any section valid?
The validator accepts it, and so do PHP and git. Python configparser does not, so add a [DEFAULT] or other header if Python reads the file.
Does it check that PHP or MySQL settings exist?
No. It checks INI structure only. Check effective PHP values with php -i, and run mysqld --validate-config to have MySQL check its own options.
Why is part of my value treated as a comment?
A # or ; preceded by a space starts an inline comment. Quote the value or remove the space if the character belongs to the value.