{"record":{"id":"aaa67e1d2030b084","repo":"JuliusBrussee/caveman","slug":"caveman-remote-session-revocation-was-unavailable","errorCode":null,"errorMessage":"caveman: remote session revocation was unavailable; credentials kept — retry `caveman logout`","messagePattern":"caveman: remote session revocation was unavailable; credentials kept — retry `caveman logout`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":9472,"sourceCode":"\t  }\n\t  const headers: Record<string, string> = {\n\t    authorization: `Bearer ${cfg.token}`,\n\t    \"x-cave-client\": \"cli\",\n\t  };\n\t  const request: RequestInit = {\n\t    method: \"POST\",\n\t    headers,\n\t    signal: AbortSignal.timeout(5000),\n\t  };\n\t  if (cfg.refreshToken) {\n\t    headers[\"content-type\"] = \"application/json\";\n\t    request.body = JSON.stringify({ refresh_token: cfg.refreshToken });\n\t  }\n\t  let response: Response;\n\t  try {\n\t    response = await fetch(`${cfg.baseURL}/api/v1/auth/logout`, request);\n\t  } catch {\n\t    throw new Error(\"caveman: remote session revocation was unavailable; credentials kept — retry `caveman logout`\");\n\t  }\n\t  if (!response.ok) throw new Error(`caveman: remote session revocation failed (HTTP ${response.status}); credentials kept — retry \\`caveman logout\\``);\n\t}\n\tif (externalToken) {\n\t  console.error(\"caveman: remote session revoked; CAVE_TOKEN remains set by the parent environment — unset it before the next command\");\n\t  print({ logged_out: true, remote_session_revoked: true, external_token_cleared: false, external_token_source: \"CAVE_TOKEN\" });\n\t  return;\n\t}\n\t// Persist remote completion before deleting the only local credential. If\n\t// Keychain/file cleanup fails, the next logout safely retries cleanup without\n\t// trying to authenticate with the now-revoked session.\n\tawait saveConfig({ ...cfg, logoutPendingLocalCleanup: true });\n  clearToken(cfg.tokenStore);\n  await saveConfig({ baseURL: \"\", token: \"\" });\n  print({ logged_out: true });\n}\n\nfunction sleep(ms: number) {","sourceCodeStart":9454,"sourceCodeEnd":9490,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/packages/cli/src/index.ts#L9454-L9490","documentation":"Logout's remote session revocation request failed at the transport level (network error). Credentials are intentionally retained and the user is told to retry `caveman logout` rather than being logged out with a live server session.","triggerScenarios":"Thrown at packages/cli/src/index.ts:8627 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry `caveman logout` after restoring connectivity","Verify the configured baseURL is reachable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5184b3d11ac6a1acb7d44b9bfaa31698157cff97","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}