louislam/dockge · critical · Error
Unknown Database type:
Error message
Unknown Database type:
What it means
Database.connect builds a knex config only for dbConfig.type === 'sqlite'; any other string reaches the else branch and throws 'Unknown Database type: <type>'. This build only ships a sqlite driver, so mysql/mariadb/postgres values in db-config.json are rejected at startup. This one is thrown inside connect() itself, and while readDBConfig errors are caught, this error propagates.
Source
Thrown at backend/database.ts:130
Dialect.prototype._driver = () => sqlite;
config = {
client: Dialect,
connection: {
filename: Database.sqlitePath,
acquireConnectionTimeout: acquireConnectionTimeout,
},
useNullAsDefault: true,
pool: {
min: 1,
max: 1,
idleTimeoutMillis: 120 * 1000,
propagateCreateError: false,
acquireTimeoutMillis: acquireConnectionTimeout,
}
};
} else {
throw new Error("Unknown Database type: " + dbConfig.type);
}
const knexInstance = knex(config);
// @ts-ignore
R.setup(knexInstance);
if (process.env.SQL_LOG === "1") {
R.debug(true);
}
// Auto map the model to a bean object
R.freeze(true);
if (autoloadModels) {
R.autoloadModels("./backend/models", "ts");
}
View on GitHub (pinned to f809ae192b)
Solutions
- Set db-config.json type to "sqlite" (the only supported type in this build)
- Delete db-config.json and restart so the default sqlite config is written
- If you need another database, check the project version/docs — this codebase only implements sqlite
Example fix
// before (db-config.json)
{"type": "mariadb"}
// after
{"type": "sqlite"} Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = ["sqlite"];
const cfg = JSON.parse(fs.readFileSync(dataDir + "/db-config.json", "utf-8"));
if (!SUPPORTED.includes(cfg.type)) { throw new Error(`Unsupported db type '${cfg.type}'; only ${SUPPORTED.join(', ')} is supported`); } Type guard
function isSupportedDBConfig(v: unknown): v is { type: "sqlite" } { return typeof v === "object" && v !== null && (v as any).type === "sqlite"; } Try / catch
try { await Database.connect(); } catch (e) { if (String(e.message).startsWith("Unknown Database type")) { fs.writeFileSync(dataDir + "/db-config.json", JSON.stringify({ type: "sqlite" })); return Database.connect(); } throw e; } Prevention
- Do not copy db-config.json from Uptime Kuma or other projects — Dockge only supports sqlite
- Check the supported dialects in Database.connect before editing the config
- Keep a validated backup of a known-good db-config.json
When it happens
Trigger: db-config.json contains {"type": "mariadb"} (copied from Uptime Kuma) or "mysql"/"postgres"; running a Dockge version that dropped a previously-supported dialect.
Common situations: Users migrating from Uptime Kuma assume the same db types are supported; hand-edited config; file copied between apps sharing a data dir.
Related errors
- Invalid db-config.json, it must be an object
- Invalid db-config.json, type must be a string
- Agent not found
- Fatal error: ${this.config.dataDir} is not a directory
- Dockge has been initialized. If you want to run setup again,
AI-assisted analysis of louislam/dockge@f809ae192b (2026-08-31).
Data as JSON: /api/errors/4336fee6df391414.
Report an issue: GitHub.