{"record":{"id":"c2be1325b06d65ec","repo":"louislam/uptime-kuma","slug":"status-code-result-statuscode-not-accepted-out","errorCode":null,"errorMessage":"Status code ${result.statusCode} not accepted. Output: ${result.rawOutput}","messagePattern":"Status code (.+?) not accepted\\. Output: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/globalping.js","lineNumber":228,"sourceCode":"        let measurement = await client.awaitMeasurement(res.data.id);\n\n        if (!measurement.ok) {\n            throw new Error(\n                `Failed to fetch measurement (${res.data.id}): ${this.formatApiError(measurement.data.error)}`\n            );\n        }\n\n        const probe = measurement.data.results[0].probe;\n        const result = measurement.data.results[0].result;\n\n        if (result.status === \"failed\") {\n            throw new Error(this.formatResponse(probe, `Failed: ${result.rawOutput}`));\n        }\n\n        heartbeat.ping = result.timings.total || 0;\n\n        if (!checkStatusCode(result.statusCode, JSON.parse(monitor.accepted_statuscodes_json))) {\n            throw new Error(\n                this.formatResponse(probe, `Status code ${result.statusCode} not accepted. Output: ${result.rawOutput}`)\n            );\n        }\n\n        heartbeat.msg = this.formatResponse(probe, `${result.statusCode} - ${result.statusCodeName}`);\n\n        // keyword\n        if (monitor.keyword) {\n            await this.handleKeywordForHTTP(monitor, heartbeat, result, probe);\n            return;\n        }\n\n        // json-query\n        if (monitor.expectedValue) {\n            await this.handleJSONQueryForHTTP(monitor, heartbeat, result, probe);\n            return;\n        }\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/globalping.js#L210-L246","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the returned status code (or its class) to the monitor's Accepted Status Codes list","Fix the target server if it is genuinely erroring (500/502/503)","If the code is expected behaviour (e.g. 401 without credentials), include it in accepted codes"],"exampleFix":"// before: only 200-299 accepted\n// after: include 301,302,401 in the monitor's accepted_statuscodes array\n[\"200-299\", \"301\", \"302\", \"401\"]","handlingStrategy":"validation","validationCode":"// Validate accepted status codes before the monitor runs\nlet accepted;\ntry {\n    accepted = JSON.parse(monitor.accepted_statuscodes_json);\n} catch {\n    throw new Error(\"accepted_statuscodes_json is not valid JSON\");\n}\nif (!Array.isArray(accepted) || accepted.length === 0) {\n    throw new Error(\"No accepted status codes configured\");\n}","typeGuard":null,"tryCatchPattern":"// Include the returned code in the heartbeat so the operator can act\nif (!checkStatusCode(result.statusCode, accepted)) {\n    throw new Error(this.formatResponse(probe,\n        `Status code ${result.statusCode} not accepted. Output: ${result.rawOutput}`));\n}","preventionTips":["Configure accepted status codes per monitor rather than relying on the 200-299 default","Include expected non-2xx codes (301/302/401/404) when they are legitimate","Review accepted codes whenever the target's behaviour changes"],"tags":["globalping","http","status-code","config"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}