louislam/uptime-kuma · critical · Error

Unknown Database type: ${dbConfig.type}

Error message

Unknown Database type: ${dbConfig.type}

What it means

At the bottom of the knex config switch in Database.connect(), after handling 'sqlite', 'mariadb'/'mysql' and 'embedded-mariadb', any other dbConfig.type value falls through to this throw. It is a literal fallthrough default — the supported set is hardcoded in this if/else chain (see database.js:387-409). The message echoes the offending type so the operator can see exactly what was read.

Source

Thrown at server/database.js:409

            config = {
                client: "mysql2",
                connection: {
                    socketPath: embeddedMariaDB.socketPath,
                    user: embeddedMariaDB.username,
                    database: "kuma",
                    timezone: "Z",
                    typeCast: function (field, next) {
                        if (field.type === "DATETIME") {
                            // Do not perform timezone conversion
                            return field.string();
                        }
                        return next();
                    },
                },
                pool: mariadbPoolConfig,
            };
        } else {
            throw new Error("Unknown Database type: " + dbConfig.type);
        }

        // Set to utf8mb4 for MariaDB
        if (dbConfig.type.endsWith("mariadb")) {
            config.pool = {
                afterCreate(conn, done) {
                    conn.query("SET CHARACTER SET utf8mb4;", (err) => done(err, conn));
                },
            };
        }

        const knexInstance = knex(config);

        R.setup(knexInstance);

        if (process.env.SQL_LOG === "1") {
            R.debug(true);
        }

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Set type to one of the supported values: "sqlite", "mariadb", "embedded-mariadb" (mysql is accepted via the mariadb branch).
  2. Check for trailing whitespace or wrong case in db-config.json — the match is exact and lowercase.
  3. If you intended PostgreSQL, know it is not supported; choose sqlite or mariadb.
  4. After editing, restart Uptime Kuma so readDBConfig() re-reads the file.

Example fix

// before — data/db-config.json
{ "type": "postgres" }

// after — pick a supported backend
{ "type": "mariadb", "hostname": "127.0.0.1", "port": 3306, "database": "kuma", "username": "kuma", "password": "secret" }
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(["sqlite", "mariadb", "embedded-mariadb"]);
function assertSupportedType(cfg) {
    if (!SUPPORTED.has(cfg.type)) {
        throw new Error(`Unsupported db type '${cfg.type}'. Supported: ${[...SUPPORTED].join(", ")}`);
    }
}

Type guard

function isSupportedDbType(cfg) {
    return cfg !== null && ["sqlite", "mariadb", "embedded-mariadb"].includes(cfg.type);
}

Try / catch

try {
    await Database.connect();
} catch (e) {
    if (/Unknown Database type/.test(e.message)) {
        // fix db-config.json type, then restart
    }
    throw e;
}

Prevention

When it happens

Trigger: db-config.json `type` is a typo (e.g. "sqlite3", "postgres", "mysql2", "mariadb " with trailing space, "SQLITE" in uppercase); a future/incompatible dbConfig from a newer version; manual edit to an unsupported backend like postgres.

Common situations: Operators switching databases who type an unrecognised engine name; case sensitivity mistakes; configs ported from another tool that uses different driver names.

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/657e7755d2da47de. Report an issue: GitHub.