Ghost "Invalid config" / config file error in CI
Ghost reads config.<env>.json for its url, database, and mail settings. If that file is missing, malformed, or lacks required keys, Ghost fails at startup with a config validation error before serving anything.
What this error means
Ghost startup fails with "Error: Config file is not valid JSON" or "Error: 'url' is required" / "database is not configured", naming config.production.json.
Error: Config file is not valid JSON
at parse (.../node_modules/bson/...)
config.production.json
----------------------------------------
"Please check your config file for syntax errors."Common causes
The config file is malformed JSON
A trailing comma or unquoted key makes config.production.json invalid, and Ghost cannot parse it.
Required keys or the config file are missing
The runner has no config.<env>.json, or it lacks url and database, so Ghost's config validation fails.
How to fix it
Write a valid config from CI values
- Generate
config.<env>.jsonwith strict JSON (no trailing commas). - Include url, database, and any required keys.
- Validate it parses before starting Ghost.
cat > config.production.json <<'EOF'
{
"url": "http://localhost:2368",
"database": { "client": "mysql", "connection": {
"host": "127.0.0.1", "user": "root", "password": "root", "database": "ghost"
} }
}
EOF
node -e "JSON.parse(require('fs').readFileSync('config.production.json'))"Configure via environment variables
Ghost reads nested config from env vars, avoiding a JSON file entirely.
env:
url: http://localhost:2368
database__client: mysql
database__connection__host: 127.0.0.1How to prevent it
- Generate Ghost config from CI and validate it parses.
- Keep required keys (url, database) present per environment.
- Prefer env-var config to avoid JSON syntax mistakes.