Diagnostic Queries
Symptoms
PostgreSQL could not parse a configuration file (such as postgresql.conf or pg_hba.conf) because of a syntax problem near the reported token. It raises SQLSTATE F0000 (config_file_error).
- The message names the file, line number, and offending token.
- Often appears at startup or after a reload.
- A bad line can prevent the server from starting.
What the server log shows
FATAL: syntax error in file "/etc/postgresql/18/main/postgresql.conf" line 142, near token "on"
Why PostgreSQL raises this — what the manual says
Section 19.1.2 Parameter Interaction via the Configuration File:
“One parameter is specified per line.”
On startup or reload, PostgreSQL parses configuration files line by line. A malformed entry (bad quoting, missing value, stray token) stops parsing and is reported as F0000, with the location to fix.
Common causes
- A missing or unbalanced quote/value in a parameter line.
- An invalid keyword or stray character.
- A malformed
pg_hba.conf/postgresql.confedit.
How to fix it
- Open the named file at the reported line and fix the syntax.
- Quote string values correctly and ensure each setting has a value.
- Validate before reload (e.g.
postgres -Cchecks or a config linter), thenSELECT pg_reload_conf();.
Related & next steps
Reference: PostgreSQL 18 Section 20.1 “Setting Parameters”.
Thanks — noted. This helps keep the database accurate.