{"record":{"id":"710162e26b2e8c7f","repo":"zeroclaw-labs/zeroclaw","slug":"minimax-oauth-refresh-failed-detail","errorCode":null,"errorMessage":"MiniMax OAuth refresh failed: {detail}","messagePattern":"MiniMax OAuth refresh failed: (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/lib.rs","lineNumber":491,"sourceCode":"        let detail = parsed\n            .as_ref()\n            .and_then(|payload| payload.base_resp.as_ref())\n            .and_then(|base| base.status_msg.as_deref())\n            .filter(|msg| !msg.trim().is_empty())\n            .unwrap_or(body.as_str());\n        anyhow::bail!(\"MiniMax OAuth refresh failed (HTTP {status}): {detail}\");\n    }\n\n    if let Some(payload) = parsed {\n        if let Some(status_text) = payload.status.as_deref()\n            && !status_text.eq_ignore_ascii_case(\"success\")\n        {\n            let detail = payload\n                .base_resp\n                .as_ref()\n                .and_then(|base| base.status_msg.as_deref())\n                .unwrap_or(status_text);\n            anyhow::bail!(\"MiniMax OAuth refresh failed: {detail}\");\n        }\n        if let Some(token) = payload\n            .access_token\n            .as_deref()\n            .map(str::trim)\n            .filter(|token| !token.is_empty())\n        {\n            return Ok(token.to_string());\n        }\n    }\n    anyhow::bail!(\"MiniMax OAuth refresh response missing access_token\")\n}\n\nfn resolve_qwen_oauth_context(credential_override: Option<&str>) -> QwenOauthProviderContext {\n    let override_value = credential_override\n        .map(str::trim)\n        .filter(|value| !value.is_empty());\n    let placeholder_requested = override_value","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/lib.rs#L473-L509","documentation":"The MiniMax token endpoint returned HTTP 2xx with parseable JSON, but the payload's top-level `status` field is not \"success\" (case-insensitive). ZeroClaw reports base_resp.status_msg (or the status text itself). MiniMax signals soft failures through this status envelope rather than the HTTP status, so both layers are checked separately.","triggerScenarios":"Refresh response `{\"status\":\"fail\",\"base_resp\":{\"status_code\":1004,\"status_msg\":\"invalid refresh token\"}}` with HTTP 200; any non-success status string (e.g. \"error\", \"invalid_token\").","commonSituations":"Expired or revoked MiniMax refresh tokens; tokens issued for a different app/region; rate-limit responses delivered in the success-shaped envelope.","solutions":["Read status_msg — it carries the provider's real reason (token invalid, expired, rate limited)","Refresh or reissue the oauth_refresh_token when status_msg indicates an invalid token","Retry after a pause when status_msg indicates rate limiting","Confirm the token belongs to the same account/region as the configured endpoint"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match refresh_minimax_oauth_access_token(&token, &client_id, region) {\n    Err(e) => {\n        let msg = e.to_string();\n        if msg.contains(\"rate\") || msg.contains(\"limit\") {\n            retry_after(cooldown)\n        } else {\n            Reauth::required(\"reissue MiniMax oauth_refresh_token\")\n        }\n    }\n    ok => ok,\n}","preventionTips":["Parse base_resp.status_msg — the HTTP status alone misclassifies MiniMax failures","Cache the access token until near its expiry instead of refreshing every request"],"tags":["minimax","oauth","refresh-token","api-status","authentication"],"backgroundTag":"oauth-refresh-token-failed","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}