{"record":{"id":"5a6c43b352de8bc5","repo":"tinyhumansai/openhuman","slug":"failed-status-text","errorCode":null,"errorMessage":"{} {} failed ({status}): {text}","messagePattern":"(.+?) (.+?) failed \\((.+?)\\): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/api/rest.rs","lineNumber":848,"sourceCode":"                        \"{} {} failed ({status}); response_body_len={}; body_shape={}\",\n                        method.as_str(),\n                        url.path(),\n                        text.len(),\n                        body_shape,\n                    )\n                    .as_str(),\n                    \"backend_api\",\n                    \"authed_json\",\n                    &[\n                        (\"method\", method.as_str()),\n                        (\"path\", url.path()),\n                        (\"host\", host),\n                        (\"status\", status_str.as_str()),\n                        (\"failure\", \"non_2xx\"),\n                    ],\n                );\n            }\n            anyhow::bail!(\n                \"{} {} failed ({status}): {text}\",\n                method.as_str(),\n                url.path()\n            );\n        }\n    }\n\n    /// Lists all active integrations for the current user.\n    pub async fn list_integrations(&self, bearer_jwt: &str) -> Result<Vec<IntegrationSummary>> {\n        let value = self\n            .authed_json(bearer_jwt, Method::GET, \"auth/integrations\", None)\n            .await?;\n        let integrations = value\n            .get(\"integrations\")\n            .cloned()\n            .unwrap_or_else(|| value.clone());\n        serde_json::from_value(integrations).context(\"parse integrations response\")\n    }","sourceCodeStart":830,"sourceCodeEnd":866,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/api/rest.rs#L830-L866","documentation":"The generic non-2xx failure from authed_json: after emitting an observability span with method/path/host/status and failure=non_2xx attributes, it bails with '{method} {path} failed ({status}): {text}'. Any authenticated backend response outside 2xx that is not specially handled (401 session expiry, channel-message 404, announcements 404) lands here, with the response body text embedded.","triggerScenarios":"4xx from request shapes the backend rejects outright; 429 rate limiting; 5xx during a backend incident or deploy window; gateway 502/504 timeouts - all on any authed_json or IntegrationClient route.","commonSituations":"Backend outage or rolling deploy; payload schema drift between app and backend; hammering an endpoint past its rate limit; proxy or corporate TLS middleware injecting errors.","solutions":["Branch on the {status} embedded in the message: 4xx fix the request, 429 back off, 5xx retry later.","Correlate with the emitted span attributes (method, path, host, status) in your telemetry backend.","Align app, SDK, and backend versions if a route or contract changed.","For 5xx storms, check backend status before assuming a client bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Parse the status out of the message with a regex like /failed \\((\\d+)\\)/ and branch: 401 -> refresh session; 429 -> back off with the Retry-After hint; 5xx -> retry later with jitter; other 4xx -> fix the request. Correlate with the emitted span attributes (method, path, host, status).","preventionTips":["Wrap authed_json calls in a single error-classification helper instead of string-matching at every call site.","Never retry 4xx blindly - only 429 and 5xx are retryable.","Emit the method/path/status tuple into logs when a route starts failing to spot backend incidents fast."],"tags":["http","backend-api","non-2xx","observability","rate-limit"],"backgroundTag":"http-request-failed","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}