{"record":{"id":"fe2bc4ebc18e31d5","repo":"xai-org/grok-build","slug":"failed-to-start-auth-provider-command-e","errorCode":null,"errorMessage":"failed to start auth provider `{command}`: {e}","messagePattern":"failed to start auth provider `(.+?)`: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/auth/flow.rs","lineNumber":210,"sourceCode":"        over_stale_credential,\n        inherit_stderr,\n        \"auth: running external auth provider (interactive login)\"\n    );\n    let mut cmd = crate::util::subprocess::shell_c(command);\n    cmd.stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .kill_on_drop(true);\n    if inherit_stderr {\n        cmd.stderr(std::process::Stdio::inherit());\n    } else {\n        cmd.stderr(std::process::Stdio::piped());\n    }\n    xai_grok_tools::util::detach_command(&mut cmd);\n    cmd.envs(xai_grok_tools::util::pager_env());\n    #[allow(clippy::disallowed_methods)]\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow::anyhow!(\"failed to start auth provider `{command}`: {e}\"))?;\n    let stderr_task = if let Some(cb) = on_stderr {\n        let stderr = child.stderr.take().expect(\"stderr was set to piped\");\n        Some(tokio::task::spawn_local(async move {\n            let mut reader = tokio::io::BufReader::new(stderr);\n            let mut line = String::new();\n            loop {\n                line.clear();\n                match reader.read_line(&mut line).await {\n                    Ok(0) => break,\n                    Ok(_) => {\n                        let trimmed = line.trim_end();\n                        tracing::debug!(line = trimmed, \"auth: provider stderr\");\n                        cb(trimmed);\n                    }\n                    Err(e) => {\n                        tracing::warn!(error = %e, \"auth: error reading provider stderr\");\n                        break;\n                    }","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/auth/flow.rs#L192-L228","documentation":"run_external_auth_provider builds a command for the configured external auth provider and spawns it. This error wraps the std::io::Error returned by cmd.spawn() when the OS cannot launch the provider executable. It means the auth flow itself is fine but the provider command could not be started.","triggerScenarios":"Calling any login flow (run_auth_flow_steps, mint_session_noninteractive, interactive login) where the configured external auth provider command binary does not exist, is not on PATH, lacks the execute bit, or the working directory/env is unusable so spawn() returns Err.","commonSituations":"Provider path configured as a bare name not installed; script missing +x after a checkout on a new machine; config points to a binary removed by an upgrade; PATH differs under CI or systemd environments.","solutions":["Verify the configured provider command resolves on PATH: `command -v <command>` and install or correct the path in auth config.","Make the provider executable: `chmod +x <script>` and confirm its shebang line exists.","Re-run with the same environment interactively; if it works in a shell but not the app, fix PATH in the app's environment (env vars, shell profile, service unit).","If the provider is a script interpreter issue, check the shebang points to an installed interpreter."],"exampleFix":"// before\nauthProvider = \"my-provider-script\"\n// after (ensure installed + executable, or use absolute path)\nauthProvider = \"/usr/local/bin/my-provider-script\"","handlingStrategy":"validation","validationCode":"const cmd = cfg.authProviderCommand;\nif (!commandExists(cmd)) {\n  throw new Error(`auth provider not found on PATH: ${cmd}`);\n}\n// shell: command -v \"$cmd\" >/dev/null || exit 1","typeGuard":null,"tryCatchPattern":"match run_auth_flow(...).await {\n    Err(e) if e.to_string().contains(\"failed to start auth provider\") => {\n        eprintln!(\"Provider `{}` missing/not executable — check PATH and +x\", provider_cmd);\n    }\n    other => other?,\n}","preventionTips":["Pin the provider with an absolute path in config","Add a preflight check (`command -v`) in setup scripts","Ensure scripts are committed with the executable bit","Keep PATH consistent between shells, CI, and services"],"tags":["auth","process-spawn","external-provider","cli"],"backgroundTag":"command-not-found","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}