NginxProxyManager/nginx-proxy-manager · critical · Error

Database config does not exist! Please read the instructions

Error message

Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup/

What it means

Nginx Proxy Manager reads its configuration from config.json (or corresponding environment variables) at startup. generateDbConfig throws this error when the 'database' key is missing entirely, meaning the app has no way to connect to any database backend (SQLite, MySQL, or Postgres). It is thrown lazily the first time the database singleton is requested via getInstance, so a totally absent config fails fast rather than producing confusing downstream connection errors.

Source

Thrown at backend/db.js:8

import knex from "knex";
import { configGet, configHas } from "./lib/config.js";

let instance = null;

const generateDbConfig = () => {
	if (!configHas("database")) {
		throw new Error(
			"Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup/",
		);
	}

	const cfg = configGet("database");

	if (cfg.engine === "knex-native") {
		return cfg.knex;
	}

	return {
		client: cfg.engine,
		connection: {
			host: cfg.host,
			user: cfg.user,
			password: cfg.password,
			database: cfg.name,
			port: cfg.port,

View on GitHub (pinned to 934a3fafe5)

Solutions

  1. Create or restore backend/config.json with a "database" block; simplest is the default SQLite config: {"database":{"engine":"sqlite","filename":"/data/database.sqlite"}}
  2. If using Docker, ensure the config file is correctly mounted/copied into the image and that /data exists and is writable
  3. Verify the config key is exactly "database" (singular) and the JSON is valid (no trailing commas, correct quotes)
  4. In dev environments, copy the provided example config (config.example.json or the one from the setup docs) and edit it rather than writing from scratch

Example fix

// before: config.json is missing or has no database key
{}

// after
{
  "database": {
    "engine": "sqlite",
    "filename": "/data/database.sqlite"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';

const hasDbConfig = (path = 'config.json') => {
  if (!fs.existsSync(path)) return false;
  try {
    return Object.prototype.hasOwnProperty.call(JSON.parse(fs.readFileSync(path, 'utf8')), 'database');
  } catch {
    return false;
  }
};

if (!hasDbConfig()) {
  console.error('Missing config.json database block — see https://nginxproxymanager.com/setup/');
  process.exit(1);
}

Type guard

const hasDatabaseConfig = (cfg: unknown): cfg is { database: Record<string, unknown> } =>
  typeof cfg === 'object' && cfg !== null && 'database' in cfg;

Try / catch

try {
  const db = getInstance();
} catch (e) {
  if (e instanceof Error && e.message.includes('Database config does not exist')) {
    // surface setup instructions, fail startup cleanly
  }
  throw e;
}

Prevention

When it happens

Trigger: Starting the backend without a config.json file in the backend directory, or with a config.json that lacks the top-level "database" object. Also occurs when environment-based configuration is expected but the relevant env vars/config file were never created, e.g. running `node index.js` directly after a fresh clone without following setup docs.

Common situations: Fresh installs where the user skipped the setup instructions, Docker volumes that mount over /etc/nginx-proxy-manager and hide the default config.json, config.json with a typo in the key name (e.g. "databases"), or running from the wrong working directory so the config loader cannot find the file.

Related errors


AI-assisted analysis of NginxProxyManager/nginx-proxy-manager@934a3fafe5 (2026-08-27). Data as JSON: /api/errors/b79b076a5823b4fa. Report an issue: GitHub.