{"record":{"id":"43d0fb082ba6ae2c","repo":"xai-org/grok-build","slug":"oidcerror-notconfigured","errorCode":null,"errorMessage":"OidcError::NotConfigured","messagePattern":"OidcError::NotConfigured","errorType":"exception","errorClass":"OidcError","httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/auth/oidc/login.rs","lineNumber":356,"sourceCode":"            anyhow::Error::new(OidcError::CallbackChannelClosed)\n        })?;\n\n    let _ = shutdown_tx.send(());\n    let _ = server.await;\n\n    result.map_err(|e| anyhow::Error::new(OidcError::CallbackAuthFailed(e)))\n}\n\n/// Run the full OIDC login flow: discovery → PKCE → browser → callback → token exchange → persist.\npub async fn run_login_flow(\n    config: &GrokComConfig,\n    auth_manager: &Arc<AuthManager>,\n    channels: Option<super::super::flow::AuthChannels>,\n) -> anyhow::Result<(GrokAuth, bool)> {\n    let oidc = config\n        .oidc\n        .as_ref()\n        .ok_or_else(|| anyhow::Error::new(OidcError::NotConfigured))?;\n    run_login_flow_with_config(oidc, auth_manager, channels).await\n}\n\n/// Run the OIDC login flow with an explicit [`OidcAuthConfig`].\n///\n/// Also used by the OAuth2 provider path via [`OAuth2ProviderConfig::as_oidc`].\n///\n/// The flow races two input paths:\n///   - **Path A**: A loopback HTTP server on `127.0.0.1` that receives the IdP redirect.\n///   - **Path B**: Stdin paste — the user manually pastes the callback URL or bare auth code.\n///\n/// Path B is essential for remote VMs where the browser runs on a different machine\n/// and the `127.0.0.1` redirect cannot reach the CLI process.\n/// * `channels` — `Some`: pushes the auth URL to the TUI and receives pasted codes.\n///   `None`: prints to stderr / reads stdin (CLI mode).\npub async fn run_login_flow_with_config(\n    oidc: &OidcAuthConfig,\n    auth_manager: &Arc<AuthManager>,","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/auth/oidc/login.rs#L338-L374","documentation":"`run_login_flow` requires the GrokComConfig to carry an OIDC configuration block. This error is thrown when `config.oidc` is None — OIDC login was requested but never configured, so there is no issuer/client_id to drive discovery and the authorize URL.","triggerScenarios":"Calling run_login_flow (or the CLI login command) with a GrokComConfig whose `oidc` field is None — `config.oidc.as_ref().ok_or_else(|| OidcError::NotConfigured)?` fires immediately, before any network activity.","commonSituations":"Fresh install without running OIDC setup; config file missing the [oidc] section; typo in config key so it fails to deserialize into `oidc`; environment where only API-key auth is configured; using the OAuth2 provider path without as_oidc mapping present.","solutions":["Add the `oidc` section (issuer, client_id, etc.) to your GrokComConfig / config file before logging in.","Run the provider's setup/config command to generate the OIDC configuration.","Check for config key typos or a wrong config file path being loaded (verify which file the tool actually reads).","If you intend non-OIDC auth (API key), use the appropriate login/auth path instead of run_login_flow."],"exampleFix":"// before: config without oidc\nlet cfg = GrokComConfig { oidc: None, .. };\n// after\nlet cfg = GrokComConfig {\n    oidc: Some(OidcAuthConfig {\n        issuer: \"https://idp.example.com\".into(),\n        client_id: \"my-client\".into(),\n        ..Default::default()\n    }),\n    ..\n};","handlingStrategy":"validation","validationCode":"// run before calling run_login_flow\nif config.oidc.is_none() {\n    return Err(anyhow!(\n        \"OIDC is not configured: add the [oidc] section (issuer, client_id) to your config\"\n    ));\n}","typeGuard":"fn is_not_configured(err: &anyhow::Error) -> bool {\n    err.downcast_ref::<OidcError>()\n        .map_or(false, |e| matches!(e, OidcError::NotConfigured))\n}","tryCatchPattern":"match run_login_flow(config, auth_manager, channels).await {\n    Err(e) if is_not_configured(&e) => {\n        eprintln!(\"OIDC not configured. Run the setup command or add the oidc block to your config file.\");\n    }\n    other => other?,\n}","preventionTips":["Always populate config.oidc before invoking login flows","Validate the loaded config (issuer + client_id present) at startup","Check you are loading the intended config file path","Watch for key typos that silently drop the oidc section during deserialization"],"tags":["oidc","configuration","missing-config"],"backgroundTag":"missing-config","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}