{"record":{"id":"a719f288fe256d03","repo":"nikivdev/code","slug":"unauthorized-check-your-token-with-f-env-login","errorCode":null,"errorMessage":"Unauthorized. Check your token with `f env login`.","messagePattern":"Unauthorized\\. Check your token with `f env login`\\.","errorType":"exception","errorClass":null,"httpStatus":401,"severity":"error","filePath":"src/env.rs","lineNumber":1450,"sourceCode":"        \"sealerId\": identity.sealer_id,\n    });\n    if let Some(label) = default_env_sealer_label() {\n        body[\"label\"] = serde_json::json!(label);\n    }\n\n    let resp = client\n        .post(url)\n        .header(\"Authorization\", format!(\"Bearer {}\", token))\n        .json(&body)\n        .send()\n        .context(\"failed to connect to cloud\")?;\n\n    if resp.status() == 404 {\n        return Ok(identity);\n    }\n\n    if resp.status() == 401 {\n        bail!(\"Unauthorized. Check your token with `f env login`.\");\n    }\n\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp.text().unwrap_or_default();\n        bail!(\"API error {}: {}\", status, body);\n    }\n\n    Ok(identity)\n}\n\nfn fetch_project_member_sealer_ids(\n    project_name: &str,\n    self_sealer_id: &str,\n    api_url: &str,\n    token: &str,\n    client: &reqwest::blocking::Client,\n) -> Result<Vec<String>> {","sourceCodeStart":1432,"sourceCodeEnd":1468,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/env.rs#L1432-L1468","documentation":"Error \"Unauthorized. Check your token with `f env login`.\" thrown in nikivdev/code.","triggerScenarios":"Thrown at src/env.rs:1450 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}