Hmbown/CodeWhale · error
Mobile session bootstrap was incomplete
Error message
Mobile session bootstrap was incomplete
What it means
The mobile web runtime persists its session in localStorage and restores it via useMobileSession(session). If the restored/returned session object is missing or its `request_proof` field is not a string, the bootstrap data needed to authenticate subsequent API calls is absent, so the runtime refuses to adopt the session.
Solutions
- Clear the saved mobile session (clearMobileSession() or remove the localStorage key) and reconnect with a Runtime token via connectMobileSession.
- Verify the endpoint that produces the session still returns a string `request_proof` field.
- Check for version mismatch between the served runtime_mobile.html and the Runtime server API.
Example fix
// before
useMobileSession(JSON.parse(localStorage.getItem('codewhale-mobile-session')));
// after
const saved = JSON.parse(localStorage.getItem('codewhale-mobile-session') || 'null');
if (saved && typeof saved.request_proof === 'string') useMobileSession(saved);
else await connectMobileSession(); Defensive patterns
Strategy: validation
Validate before calling
if (!session || typeof session.request_proof !== 'string') {
clearMobileSession();
await connectMobileSession();
} else {
useMobileSession(session);
} Type guard
function isUsableSession(s) {
return !!s && typeof s.request_proof === 'string';
} Try / catch
try {
useMobileSession(savedSession);
} catch {
clearMobileSession();
await connectMobileSession();
} Prevention
- Always clear and re-bootstrap the session when the stored shape does not validate.
- Version the localStorage key so schema changes invalidate old sessions.
- Never hand-edit stored session blobs.
When it happens
Trigger: Calling useMobileSession with null/undefined, or with an object whose `request_proof` is missing, null, or a non-string (e.g. a stale or hand-edited localStorage value, or a server response missing the field).
Common situations: A stale or schema-changed saved session in localStorage after a Runtime upgrade; a server that changed the session payload shape; manually clearing/corrupting localStorage entries.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- invalid session id
- invalid session id for memory reconcile
- legacy spillover ownership requires a session id
- --resume/--session-id needs a session id, but got an empty…
- Saved Runtime store path must be absolute
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/64a310a8d61668f1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/runtime_mobile.html:325
state.streamTicket = "";
sessionStorage.removeItem(SESSION_STORAGE_KEY);
}
function loadMobileSession() {
try {
const stored = JSON.parse(sessionStorage.getItem(SESSION_STORAGE_KEY) || "null");
if (stored && typeof stored.requestProof === "string") {
state.requestProof = stored.requestProof;
state.streamTicket = typeof stored.streamTicket === "string" ? stored.streamTicket : "";
}
} catch (_) {
clearMobileSession();
}
}
function useMobileSession(session) {
if (!session || typeof session.request_proof !== "string") {
throw new Error("Mobile session bootstrap was incomplete");
}
state.requestProof = session.request_proof;
state.streamTicket = typeof session.stream_ticket === "string" ? session.stream_ticket : "";
saveMobileSession();
}
function takeMobileSessionFromUrl() {
const hash = location.hash.startsWith("#") ? location.hash.slice(1) : "";
const params = new URLSearchParams(hash);
const requestProof = params.get("request_proof");
const streamTicket = params.get("stream_ticket");
if (!requestProof || !streamTicket) return;
useMobileSession({ request_proof: requestProof, stream_ticket: streamTicket });
params.delete("request_proof");
params.delete("stream_ticket");
const nextHash = params.toString();
history.replaceState(
null,View on GitHub (pinned to 73e0f67d83)