{"record":{"id":"bbcb02a7a684a8dd","repo":"Kuberwastaken/claurst","slug":"no-query-string-in-callback","errorCode":null,"errorMessage":"No query string in callback","messagePattern":"No query string in callback","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/cli/src/codex_oauth_flow.rs","lineNumber":134,"sourceCode":"        std::time::Duration::from_secs(300), // 5 minute timeout\r\n        listener.accept(),\r\n    )\r\n    .await\r\n    .map_err(|_| anyhow!(\"OAuth callback timeout (5 minutes)\"))?\r\n    .map_err(|e| anyhow!(\"Failed to accept connection: {}\", e))?;\r\n\r\n    let mut reader = BufReader::new(&mut socket);\r\n    let mut request_line = String::new();\r\n    reader.read_line(&mut request_line).await?;\r\n\r\n    // Parse \"GET /auth/callback?code=...&state=... HTTP/1.1\"\r\n    let parts: Vec<&str> = request_line.split_whitespace().collect();\r\n    if parts.len() < 2 {\r\n        bail!(\"Invalid HTTP request\");\r\n    }\r\n\r\n    let path = parts[1];\r\n    let query_start = path.find('?').ok_or_else(|| anyhow!(\"No query string in callback\"))?;\r\n    let query = &path[query_start + 1..];\r\n\r\n    let mut code = String::new();\r\n    let mut state = String::new();\r\n    let mut error = String::new();\r\n\r\n    for param in query.split('&') {\r\n        let kv: Vec<&str> = param.splitn(2, '=').collect();\r\n        if kv.len() == 2 {\r\n            match kv[0] {\r\n                \"code\" => code = urlencoding::decode(kv[1])?.to_string(),\r\n                \"state\" => state = urlencoding::decode(kv[1])?.to_string(),\r\n                \"error\" => error = urlencoding::decode(kv[1])?.to_string(),\r\n                \"error_description\" => error = urlencoding::decode(kv[1])?.to_string(),\r\n                _ => {}\r\n            }\r\n        }\r\n    }\r","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/cli/src/codex_oauth_flow.rs#L116-L152","documentation":"The OAuth callback parser expects the browser's request line to be `GET /path?query HTTP/1.1` and locates the authorization code by finding the `?` that starts the query string. If the request path contains no `?`, there is no code/state to extract and the flow bails with this error. It usually means the browser hit the callback URL without the OAuth parameters.","triggerScenarios":"`wait_for_callback` received a request line whose path has no query string: the user navigated to `http://127.0.0.1:<port>/` directly, the auth server redirected without parameters (error redirect handled elsewhere or stripped), or a health-check/probe hit the port.","commonSituations":"User manually refreshes or re-opens the callback URL after the query was dropped; browser extension strips URL parameters; authorization failed upstream and the redirect carried no `?code=`; port scanner or monitoring tool connecting to the local listener.","solutions":["Restart the OAuth flow and complete authorization in one pass — do not manually re-enter or refresh the callback URL.","Check the authorization provider's redirect: if an error occurred, the flow should present it — retry login.","Verify the auth URL was opened as generated (with its query parameters) rather than retyped.","If a proxy or extension is stripping query params, disable it for localhost."],"exampleFix":"// before (manual navigation)\n// http://127.0.0.1:1455/auth/callback        -> No query string in callback\n// after: use the full URL as produced by the flow\n// http://127.0.0.1:1455/auth/callback?code=...&state=...","handlingStrategy":"validation","validationCode":"// Only open the exact auth URL printed by the flow (it contains ?code=...&state=...)\n// Verify in browser devtools that the final redirect URL retains its query string.","typeGuard":null,"tryCatchPattern":"match run_oauth_flow(&mut app).await {\n    Err(e) if e.to_string().contains(\"No query string in callback\") => {\n        eprintln!(\"Callback arrived without OAuth parameters; restart the login and use the printed URL as-is\");\n    }\n    other => other?,\n}","preventionTips":["Never retype, trim, or refresh the callback URL — always follow the generated auth link end-to-end.","Disable browser extensions that rewrite or strip URL parameters for localhost.","Don't point health checks or probes at the OAuth callback port."],"tags":["oauth","http","callback","url","cli"],"backgroundTag":"invalid-url-format","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}