{"record":{"id":"26be326ac41695e7","repo":"BoundaryML/baml","slug":"timed-out-after-minutes-waiting-for-the-login-to-be","errorCode":null,"errorMessage":"Timed out after {} minutes waiting for the login to be confirmed.","messagePattern":"Timed out after (.+?) minutes waiting for the login to be confirmed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/auth.rs","lineNumber":372,"sourceCode":"/// current interval, `slow_down` widens it by five seconds, and\n/// `access_denied` / `expired_token` are terminal.\n///\n/// Errors:\n/// - When the user denies the login, the code expires, an unrecognized\n///   error is returned, or [`LOGIN_TIMEOUT`] elapses.\nfn poll_token_endpoint(\n    endpoint: &str,\n    form: &[(&str, &str)],\n    server_interval: Option<u64>,\n) -> Result<TokenResponse> {\n    let client = http_client();\n    let deadline = std::time::Instant::now() + LOGIN_TIMEOUT;\n    let mut interval = server_interval\n        .map(Duration::from_secs)\n        .unwrap_or(DEFAULT_POLL_INTERVAL);\n    loop {\n        if std::time::Instant::now() >= deadline {\n            anyhow::bail!(\n                \"Timed out after {} minutes waiting for the login to be confirmed.\",\n                LOGIN_TIMEOUT.as_secs() / 60\n            );\n        }\n        let resp = client\n            .post(endpoint)\n            .header(\"content-type\", \"application/x-www-form-urlencoded\")\n            .body(encode_form(form))\n            .send()\n            .context(\"Failed to reach the auth server\")?;\n        let status = resp.status();\n        let value: serde_json::Value = resp\n            .json()\n            .context(\"Failed to parse token endpoint response\")?;\n\n        if status.is_success() {\n            return serde_json::from_value(value).context(\"Failed to parse token response\");\n        }","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/auth.rs#L354-L390","documentation":"During `baml auth login` device flow, poll_token_endpoint polls the token endpoint until LOGIN_TIMEOUT elapses; if the login was never confirmed in the browser within that window, it bails with the timeout message (minutes are computed from LOGIN_TIMEOUT.as_secs() / 60). It means authorization_pending persisted until the deadline.","triggerScenarios":"device_login -> poll_token_endpoint looping with `authorization_pending` responses past the deadline (Instant::now() >= deadline).","commonSituations":"User never opened the confirmation URL or closed the browser tab; user took too long; polling interval misconfigured (server_interval very large) so fewer polls fit in the window.","solutions":["Re-run `baml auth login` and complete the browser confirmation promptly.","Open the printed URL / enter the confirmation code as soon as it appears.","Check network access to the auth server so the approval actually registers.","If a custom polling interval was configured, remove it or shorten it below the timeout window."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match baml_cli::auth::device_login(...) {\n    Err(e) if e.to_string().contains(\"Timed out\") => {\n        // prompt user, then retry once\n        prompt(\"complete login in browser, retry?\");\n        baml_cli::auth::device_login(...)?;\n    }\n    r => r?,\n}","preventionTips":["Complete the browser confirmation immediately after starting login.","Avoid leaving `baml auth login` idle for longer than the timeout.","Confirm network reachability of the auth server first.","Do not override the poll interval with values close to or above the timeout."],"tags":["auth","timeout","oauth-device-flow","cli"],"backgroundTag":"request-timeout","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}