{"record":{"id":"e0ba8866947843ae","repo":"Hmbown/CodeWhale","slug":"not-signed-in-run-codewhale-login-first","errorCode":null,"errorMessage":"Not signed in. Run `codewhale login` first","messagePattern":"Not signed in\\. Run `codewhale login` first","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/cloud.rs","lineNumber":548,"sourceCode":"    fn execute_authenticated(\n        &self,\n        method: HttpMethod,\n        path: &str,\n        body: Option<Vec<u8>>,\n    ) -> Result<CloudResponse> {\n        self.execute_authenticated_snapshot(method, path, body)\n            .map(|(response, _)| response)\n    }\n\n    fn execute_authenticated_snapshot(\n        &self,\n        method: HttpMethod,\n        path: &str,\n        body: Option<Vec<u8>>,\n    ) -> Result<(CloudResponse, AccountSessionSnapshot)> {\n        let snapshot = self.account_store.snapshot()?;\n        let Some(mut stored) = snapshot.load()? else {\n            bail!(\"Not signed in. Run `codewhale login` first\");\n        };\n        let first = self.transport.execute(CloudRequest {\n            method,\n            path: path.into(),\n            bearer: Some(stored.bundle.access_token.clone()),\n            body: body.clone(),\n        })?;\n        if first.status != 401 {\n            return Ok((first, snapshot));\n        }\n        // Serialize the refresh HTTP request itself with native/CLI writers:\n        // two processes must not spend the same rotating refresh token.\n        let renewed = self\n            .account_store\n            .with_transaction(|transaction| -> Result<_> {\n                if !transaction.matches(&snapshot) {\n                    bail!(\"The signed-in account changed. Refresh and try again.\");\n                }","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/cloud.rs#L530-L566","documentation":"execute_authenticated_snapshot takes a snapshot of the local account store before making an authenticated cloud request. If the store holds no saved session at all, there is no access token to attach, so it throws this error directing the user to `codewhale login`.","triggerScenarios":"Any authenticated cloud CLI command (me, key set/list, provider operations via execute_authenticated) run before ever logging in, or after the account store was cleared/removed.","commonSituations":"Fresh machine or CI environment without a prior `codewhale login`; deleted/corrupted account store file; HOME or config-dir environment differences hiding the stored session.","solutions":["Run `codewhale login` to create a session.","If you already logged in, check you are running as the same user/HOME (CI vs interactive shell) so the store is visible.","Verify the account store file exists in the expected config directory; re-login if it was deleted."],"exampleFix":"// before\ncodewhale me\n// after\ncodewhale login\ncodewhale me","handlingStrategy":"validation","validationCode":"// shell\nif ! codewhale me >/dev/null 2>&1; then\n  echo \"not signed in\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":"// Rust\nmatch cloud.call_authenticated(req) {\n    Err(e) if e.to_string().contains(\"Not signed in\") => {\n        // prompt for `codewhale login` and retry once authenticated\n    }\n    other => other,\n}","preventionTips":["Always run `codewhale login` before scripted cloud commands on a new machine/CI runner.","Ensure scripts run under the same user/HOME that performed the login.","Do not delete or move the account store file while sessions are active."],"tags":["auth","cli","cloud","not-signed-in"],"backgroundTag":"authentication-required","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}