{"record":{"id":"153bd1885241af89","repo":"nikivdev/code","slug":"remote-review-unauthorized-run-f-auth-to-login","errorCode":null,"errorMessage":"remote review unauthorized. Run `f auth` to login.","messagePattern":"remote review unauthorized\\. Run `f auth` to login\\.","errorType":"exception","errorClass":null,"httpStatus":401,"severity":"error","filePath":"src/commit.rs","lineNumber":5485,"sourceCode":"    };\n\n    let client = crate::http_client::blocking_with_timeout(Duration::from_secs(\n        commit_with_check_timeout_secs(),\n    ))\n    .context(\"failed to create HTTP client for remote review\")?;\n\n    let mut request = client.post(&review_url).json(&payload);\n    if let Some(token) = commit_with_check_review_token() {\n        request = request.bearer_auth(token);\n    }\n\n    let response = request\n        .send()\n        .context(\"failed to send remote review request\")?;\n\n    if !response.status().is_success() {\n        if response.status() == StatusCode::UNAUTHORIZED {\n            bail!(\"remote review unauthorized. Run `f auth` to login.\");\n        }\n        if response.status() == StatusCode::PAYMENT_REQUIRED {\n            bail!(\"remote review requires an active subscription. Visit myflow to subscribe.\");\n        }\n        bail!(\"remote review failed: HTTP {}\", response.status());\n    }\n\n    let payload: RemoteReviewResponse = response\n        .json()\n        .context(\"failed to parse remote review response\")?;\n\n    if !payload.stderr.trim().is_empty() {\n        debug!(stderr = payload.stderr.as_str(), \"remote claude stderr\");\n    }\n\n    let result = payload.output;\n    let mut review_json = parse_review_json(&result);\n    let future_tasks = review_json","sourceCodeStart":5467,"sourceCodeEnd":5503,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/commit.rs#L5467-L5503","documentation":"The remote review HTTP request completed but the server responded 401 Unauthorized. The library maps that specific status to this message instructing the user to authenticate with `f auth`. It indicates missing, expired, or invalid auth credentials for the myflow review service.","triggerScenarios":"POSTing the RemoteReviewRequest to the review URL when the stored auth token is absent, expired, or rejected (StatusCode::UNAUTHORIZED).","commonSituations":"Never logged in (`f auth` not run); login token expired; token revoked server-side; running in CI without auth credentials; clock skew invalidating the token.","solutions":["Run `f auth` to log in and refresh credentials, then retry the review.","Delete stale cached credentials and re-authenticate.","In CI, provision a valid API token/credentials as a secret.","Check system clock if tokens are time-based (`timedatectl`)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: cheap authenticated check before the review\nlet status = reqwest::Client::new()\n    .get(format!(\"{base}/me\"))\n    .bearer_auth(token)\n    .send().await?\n    .status();\nif status == reqwest::StatusCode::UNAUTHORIZED {\n    anyhow::bail!(\"not authenticated; run `f auth`\");\n}","typeGuard":null,"tryCatchPattern":"match run_remote_review(&diff).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"remote review unauthorized\") => {\n        eprintln!(\"Auth expired — run `f auth` first.\");\n        std::process::exit(2);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Refresh auth tokens proactively (re-run `f auth` when tokens near expiry)","Provision valid tokens as CI secrets","Detect clock skew on machines using time-based tokens","Handle 401 centrally with a re-auth-and-retry wrapper"],"tags":["auth","http-401","remote-review","network"],"backgroundTag":"http-401-unauthorized","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}