JuliusBrussee/caveman · error
caveman: remote gateway key revocation was unavailable…
Error message
caveman: remote gateway key revocation was unavailable; credentials kept — retry `caveman logout`
What it means
Thrown during `caveman logout` when the POST to revoke the remote gateway key fails at the network level (fetch throws, e.g. DNS failure, connection refused, or the 5s AbortSignal.timeout fires). Credentials are intentionally kept locally so the user can retry instead of losing the token with a half-completed logout.
Solutions
- Restore network connectivity to the gateway and re-run `caveman logout` as the message advises.
- Check `cfg.baseURL` / CAVE_BASE_URL is the correct reachable host.
- Retry later if the gateway is under maintenance; local credentials were preserved.
- If the 5s timeout is too tight on a slow link, retry when latency is lower.
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: confirm the gateway is reachable before logging out
const ok = await fetch(`${baseURL}/healthz`, { signal: AbortSignal.timeout(5000) }).then(r => r.ok).catch(() => false);
if (!ok) console.warn("Gateway unreachable — logout will keep credentials and must be retried."); Try / catch
try {
await logout();
} catch (e) {
if (e instanceof Error && e.message.includes("revocation was unavailable")) {
await new Promise(r => setTimeout(r, 2000));
await logout(); // credentials were kept, retry is safe
} else throw e;
} Prevention
- Don't log out while offline or behind flaky proxies/VPNs.
- Confirm the gateway host is reachable before logout.
- Remember credentials are preserved on this failure — retrying is always safe.
When it happens
Trigger: `caveman logout` with the remote gateway unreachable: network down, baseURL host wrong, server down, or revocation call exceeding the 5000ms AbortSignal timeout.
Common situations: Logging out offline or on a captive-portal Wi-Fi; gateway under maintenance; slow VPN making the 5s timeout fire; misconfigured CAVE_BASE_URL pointing at a dead host.
Related errors
- caveman: remote gateway key revocation failed
- caveman: remote session revocation was unavailable…
- awscreds: : http
- awscreds: sts assume role with web identity failed
- binary download failed: HTTP
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/65cf2675e8b9fb51.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:9810
}
throw new Error("device login timed out before approval");
}
async function logout() {
const cfg = await config();
const externalToken = Boolean(process.env.CAVE_TOKEN);
if (cfg.token && (!cfg.logoutPendingLocalCleanup || externalToken)) {
if (cfg.projectId && cfg.gatewayKeyId) {
let response: Response;
try {
response = await fetch(`${cfg.baseURL}/api/v1/projects/${encodeURIComponent(cfg.projectId)}/keys/${encodeURIComponent(cfg.gatewayKeyId)}/revoke`, {
method: "POST",
headers: { authorization: `Bearer ${cfg.token}`, "content-type": "application/json", "x-cave-csrf": "cli" },
body: "{}",
signal: AbortSignal.timeout(5000),
});
} catch {
throw new Error("caveman: remote gateway key revocation was unavailable; credentials kept — retry `caveman logout`");
}
if (!response.ok) {
const body = await response.json().catch(() => null) as { error?: { code?: unknown } } | null;
const alreadyRevoked = response.status === 404 && body?.error?.code === "cave_key_not_found";
if (!alreadyRevoked) throw new Error(`caveman: remote gateway key revocation failed (HTTP ${response.status}); credentials kept — retry \`caveman logout\``);
}
}
const headers: Record<string, string> = {
authorization: `Bearer ${cfg.token}`,
"x-cave-client": "cli",
};
const request: RequestInit = {
method: "POST",
redirect: "manual",
headers,
signal: AbortSignal.timeout(5000),
};
if (cfg.refreshToken) {View on GitHub (pinned to 3ee70a1026)