louislam/uptime-kuma · error · Error

Status code ${result.statusCode} not accepted. Output: ${res

Error message

Status code ${result.statusCode} not accepted. Output: ${result.rawOutput}

What it means

Thrown by the Globalping HTTP monitor path when the probe received an HTTP response but result.statusCode is not in the monitor's accepted_statuscodes_json list. The returned status code and raw output are included so you can see what the server actually returned.

Source

Thrown at server/monitor-types/globalping.js:228

        let measurement = await client.awaitMeasurement(res.data.id);

        if (!measurement.ok) {
            throw new Error(
                `Failed to fetch measurement (${res.data.id}): ${this.formatApiError(measurement.data.error)}`
            );
        }

        const probe = measurement.data.results[0].probe;
        const result = measurement.data.results[0].result;

        if (result.status === "failed") {
            throw new Error(this.formatResponse(probe, `Failed: ${result.rawOutput}`));
        }

        heartbeat.ping = result.timings.total || 0;

        if (!checkStatusCode(result.statusCode, JSON.parse(monitor.accepted_statuscodes_json))) {
            throw new Error(
                this.formatResponse(probe, `Status code ${result.statusCode} not accepted. Output: ${result.rawOutput}`)
            );
        }

        heartbeat.msg = this.formatResponse(probe, `${result.statusCode} - ${result.statusCodeName}`);

        // keyword
        if (monitor.keyword) {
            await this.handleKeywordForHTTP(monitor, heartbeat, result, probe);
            return;
        }

        // json-query
        if (monitor.expectedValue) {
            await this.handleJSONQueryForHTTP(monitor, heartbeat, result, probe);
            return;
        }

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Add the returned status code (or its class) to the monitor's Accepted Status Codes list
  2. Fix the target server if it is genuinely erroring (500/502/503)
  3. If the code is expected behaviour (e.g. 401 without credentials), include it in accepted codes

Example fix

// before: only 200-299 accepted
// after: include 301,302,401 in the monitor's accepted_statuscodes array
["200-299", "301", "302", "401"]
Defensive patterns

Strategy: validation

Validate before calling

// Validate accepted status codes before the monitor runs
let accepted;
try {
    accepted = JSON.parse(monitor.accepted_statuscodes_json);
} catch {
    throw new Error("accepted_statuscodes_json is not valid JSON");
}
if (!Array.isArray(accepted) || accepted.length === 0) {
    throw new Error("No accepted status codes configured");
}

Try / catch

// Include the returned code in the heartbeat so the operator can act
if (!checkStatusCode(result.statusCode, accepted)) {
    throw new Error(this.formatResponse(probe,
        `Status code ${result.statusCode} not accepted. Output: ${result.rawOutput}`));
}

Prevention

When it happens

Trigger: checkStatusCode(result.statusCode, JSON.parse(monitor.accepted_statuscodes_json)) returns false. E.g. the target returned 503 but the accepted list only contains 200-299.

Common situations: Accepted status codes list is too narrow (only 200-299) while the service legitimately returns 301/302/401, the target server is returning 5xx errors, or the accepted codes were never customized for this monitor.

Related errors


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