PostgreSQL raises SQLSTATE F0000 (config_file_error) when it encounters a problem reading or parsing one of its configuration files — most commonly postgresql.conf, pg_hba.conf, or pg_ident.conf. The error message typically looks like:
FATAL: configuration file "/etc/postgresql/16/main/postgresql.conf" contains errors
or, when a specific line is the culprit:
FATAL: invalid value for parameter "max_connections": "abc"
FATAL: unrecognized configuration parameter "shered_buffers"
FATAL: syntax error in file "/etc/postgresql/16/main/pg_hba.conf" at line 42, near token ";"
What This Error Means
SQLSTATE class F0 is PostgreSQL's "configuration file error" class, and F0000 is its single member condition. Unlike most runtime errors that occur during query execution, config_file_error is almost always a server-startup error. PostgreSQL reads and validates all configuration files before accepting connections; if validation fails, the server refuses to start (or, for pg_hba.conf reloads, refuses the reload and keeps the previous valid configuration).
There are two main moments when this error surfaces. The first is at server startup: if postgresql.conf contains an invalid parameter name, a bad value, or a syntax error, pg_ctl start fails and the postmaster exits with a fatal message. The second is during a live reload via pg_reload_conf() or SELECT pg_reload_conf(): PostgreSQL re-reads postgresql.conf and pg_hba.conf at that point, and if the new file is invalid it logs the error and continues running with the previously loaded configuration. In the reload case the server stays up, but the configuration change is silently not applied.
Because this error happens before any user session exists (at startup), it is never returned to a connected client over the wire — it appears only in the PostgreSQL server log and in the output of pg_ctl.
Common Causes
- Typo in a parameter name —
shered_buffersinstead ofshared_buffers, ormax_conectionsinstead ofmax_connections. PostgreSQL performs an exact match; unrecognized names are fatal. - Invalid parameter value — setting a parameter to a value outside its allowed range or of the wrong type, e.g.,
max_connections = 'lots'orwork_mem = -1MB. - Missing or extra quotes in
postgresql.conf— string parameters (likelog_line_prefix) require single quotes; omitting them causes a parse error. - Syntax error in
pg_hba.conf— a misplaced field, wrong authentication method name (e.g.,md5wherescram-sha-256is expected, or a completely unknown method), or a missing address field. - Include file not found — use of
includeorinclude_if_existsdirectives pointing to a file that is missing or unreadable by thepostgresOS user. - Encoding or line-ending issues — a configuration file saved with Windows-style CRLF line endings or with a BOM may confuse the parser on some PostgreSQL versions.
- Permission error on the file — the
postgresOS user cannot read the configuration file, causing PostgreSQL to report it as unreadable.
How to Fix config_file_error
Check the server log for the exact line number and message. PostgreSQL always logs the filename and, where possible, the line number of the offending entry. Start there before editing files blindly.
journalctl -u postgresql -n 50 # or tail -n 50 /var/log/postgresql/postgresql-16-main.logValidate
postgresql.confbefore restarting. Use the built-in check mode to parse the file without starting the server:postgres --config-file=/etc/postgresql/16/main/postgresql.conf -C max_connectionsIf the file is invalid this prints the error; if valid it prints the parameter value.
Use
pg_conftoolorpg_configto make safe edits. On Debian/Ubuntu,pg_conftooleditspostgresql.confwithout manual text editing:pg_conftool 16 main set shared_buffers 256MBValidate
pg_hba.confsyntax. There is no dedicated pre-flight tool forpg_hba.conf, but you can load it in a running instance after a failed reload:SELECT pg_reload_conf(); -- then check: SELECT * FROM pg_file_settings WHERE error IS NOT NULL; SELECT * FROM pg_hba_file_rules; -- available in PostgreSQL 10+pg_file_settingsreports any parameter that failed to apply along with the error reason.pg_hba_file_rulesshows parsed HBA rules; if a line has anerrorcolumn populated, that is your culprit.Fix file permissions if the file is unreadable:
ls -l /etc/postgresql/16/main/postgresql.conf chown postgres:postgres /etc/postgresql/16/main/postgresql.conf chmod 600 /etc/postgresql/16/main/postgresql.confRestore from a backup copy. If you made a backup before editing (recommended), restore it and test incrementally:
cp /etc/postgresql/16/main/postgresql.conf.bak \ /etc/postgresql/16/main/postgresql.conf
Additional Information
config_file_error(F0000) is the only condition in SQLSTATE classF0. There are no sub-codes; all configuration file errors share the same SQLSTATE.- A related condition to be aware of is
lock_file_exists(SQLSTATE55P01), which also prevents server startup but is unrelated to config file syntax. - The
pg_file_settingsview (PostgreSQL 9.6+) is the fastest way to catchpostgresql.confproblems on a running server without restarting it. It reflects what would happen ifpg_reload_conf()were called. - The
pg_hba_file_rulesview (PostgreSQL 10+) andpg_ident_file_mappingsview (PostgreSQL 15+) provide similar pre-flight visibility intopg_hba.confandpg_ident.confrespectively. - Application drivers never receive this error as a connection-level error code — it only appears in server logs. Monitoring systems watching PostgreSQL availability will see connection refused rather than a specific SQLSTATE.
Frequently Asked Questions
Why does my server refuse to start but I can't find anything wrong in postgresql.conf?
Check whether there are include directives at the bottom of postgresql.conf pulling in additional files (common in packaged installations, e.g., conf.d/*.conf). The error may be in one of those included files. Also verify file permissions — a world-unreadable file owned by root will cause the same symptom.
I ran SELECT pg_reload_conf() and it returned true, but my configuration change isn't active. What happened?
pg_reload_conf() returns true as long as PostgreSQL attempted the reload — not that the reload succeeded. Check pg_file_settings for rows where applied = false and error IS NOT NULL. If the file had an error, PostgreSQL silently kept the previous valid configuration.
Can I change postgresql.conf without restarting the server?
Most parameters can be changed with a reload (pg_reload_conf() or SIGHUP). Parameters marked context = postmaster in pg_settings (like max_connections and shared_buffers) require a full server restart. Parameters marked context = superuser or user can also be set per-session with SET.
Is F0000 the same as a general "internal error"?
No. SQLSTATE F0000 is specifically for configuration file parsing failures. General internal errors use SQLSTATE XX000 (internal_error). If you see XX000 in your logs, the cause is unrelated to configuration files.