{"record":{"id":"62a893de86d5c62a","repo":"tinyhumansai/openhuman","slug":"underlying-error-e","errorCode":null,"errorMessage":"{} (underlying error: {e})","messagePattern":"(.+?) \\(underlying error: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/inference/provider/factory.rs","lineNumber":2265,"sourceCode":"        })\n    } else {\n        None\n    };\n    let missing_credentials = || {\n        // Safe fields only: role, slug, and the routing shape. Never the\n        // underlying error (it can echo a key) and never the key itself.\n        log::warn!(\n            \"[providers][chat-factory] credential lookup failed role={} slug={} auth_style={} implicit_cloud_fallback={}\",\n            role,\n            slug,\n            entry.auth_style.as_str(),\n            implicit_fallback\n        );\n        super::fallback_diagnostics::missing_provider_credentials_message(role, slug, local_chat)\n    };\n\n    let key = lookup_key_for_slug(slug, config)\n        .map_err(|e| anyhow::anyhow!(\"{} (underlying error: {e})\", missing_credentials()))?;\n\n    // A readable auth profile with no key for this slug returns `Ok(\"\")`, which\n    // would otherwise build a client with an empty bearer and surface as a raw\n    // 401 from the provider several layers later — exactly the baffling error\n    // this diagnostic exists to replace.\n    //\n    // Scoped to the *implicit fallback* path deliberately. That is the case the\n    // diagnostic is for: a local-chat user whose background role landed on a\n    // BYOK slug they never configured. An explicitly routed provider keeps its\n    // existing behaviour and is allowed to build without a stored key — callers\n    // construct such models to probe or describe a provider before a key is\n    // saved, and failing that at construction time would be a behaviour change\n    // well beyond this diagnostic.\n    //\n    // Styles that carry no stored key (`OpenhumanJwt` injects a session JWT\n    // downstream, `None` sends no auth header at all) are legitimately blank and\n    // never trip this.\n    if implicit_fallback","sourceCodeStart":2247,"sourceCodeEnd":2283,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/inference/provider/factory.rs#L2247-L2283","documentation":"Wraps the underlying credential-retrieval error into a user-facing 'missing provider credentials' message (via fallback_diagnostics). The underlying error is appended but deliberately excludes any API key material; a warn log records role, slug, auth style and whether implicit cloud fallback was in play.","triggerScenarios":"Thrown at src/openhuman/inference/provider/factory.rs:2265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add credentials for the slug via the settings UI, keyring, or the appropriate environment variable","If implicit fallback picked the wrong provider, set an explicit provider string for the role","Check the warn log line for the auth_style to see which credential mechanism failed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}