louislam/uptime-kuma · error · Error

Database connection/query failed: ${error.message}

Error message

Database connection/query failed: ${error.message}

What it means

Catch-all wrapper in OracledbMonitorType.check: any error whose message does NOT contain 'did not meet the specified conditions' is re-thrown as 'Database connection/query failed: <original>'. This wraps oracledb getConnection/connectivity errors, ORA- errors, TNS errors, and credential failures.

Source

Thrown at server/monitor-types/oracledb.js:63

                heartbeat.status = UP;
                heartbeat.msg = "Query did meet specified conditions";
            } else {
                const result = await this.oracledbQuery(
                    monitor.databaseConnectionString,
                    query,
                    monitor.basic_auth_user,
                    monitor.basic_auth_pass
                );
                heartbeat.ping = dayjs().valueOf() - startTime;
                heartbeat.status = UP;
                heartbeat.msg = result;
            }
        } catch (error) {
            heartbeat.ping = dayjs().valueOf() - startTime;
            if (error.message.includes("did not meet the specified conditions")) {
                throw error;
            }
            throw new Error(`Database connection/query failed: ${error.message}`);
        }
    }

    /**
     * Run a query on Oracle Database.
     * @param {string} connectionString The Oracle DB connection string
     * @param {string} query The query to execute
     * @param {string} username Oracle DB username
     * @param {string} password Oracle DB password
     * @returns {Promise<string>} Row count or execution message
     */
    async oracledbQuery(connectionString, query, username, password) {
        let connection;
        try {
            connection = await oracledb.getConnection({
                connectString: connectionString.trim(),
                user: username.trim(),
                password: password.trim(),

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Connect with sqlplus / SQLcl from the Uptime Kuma host using the identical connect string.
  2. For Thick mode, install Oracle Instant Client and set LD_LIBRARY_PATH; for Thin mode, ensure the connectString uses the host:port/service form.
  3. Verify wallet/TLS for Autonomous Database (connect_string points at tnsnames alias with tls config).
  4. Confirm the user can SELECT the target object (grant privileges, correct schema prefix).
  5. Check listener reachability on port 1521/1522 and firewall rules.

Example fix

// before: connectString='ORCL'   (Thick mode, no Instant Client -> DPI-1047)
// after (Thin mode, no client needed):
connectString='10.0.0.5:1521/ORCLPDB1'
Defensive patterns

Strategy: retry

Validate before calling

function portOpen(host, port, ms=2000) { /* same TCP probe as MSSQL */ }
// Parse connectString host:port/service and probe 1521/1522 before relying on the monitor.

Try / catch

async function withRetry(fn, retries=3, base=1000) {
  for (let i=0;i<=retries;i++){ try { return await fn(); } catch(e){
    if (/Database connection\/query failed/.test(e.message) && i<retries) await sleep(base*2**i); else throw e; } }
}

Prevention

When it happens

Trigger: oracledb.getConnection({connectString,user,password}) rejects (ORA-12154 TNS, ORA-12541 no listener, ORA-01017 invalid credentials, DPI-1080), connection.execute rejects (ORA-00942 table not found, ORA-00936 syntax), or the single-value validation errors fire. The substring guard forwards condition-mismatch messages unchanged.

Common situations: connectString format wrong for the installed mode (Thin vs Thick); tnsnames.ora missing/misconfigured; Oracle Instant Client not installed for Thick mode; wallet/TLS not configured for cloud Autonomous DB; wrong schema so objects are not visible; listener port 1521 blocked.

Related errors


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