{"record":{"id":"ef0fd28c8053c643","repo":"stablyai/orca","slug":"session-view-overrides-could-not-be-read","errorCode":null,"errorMessage":"Session view overrides could not be read","messagePattern":"Session view overrides could not be read","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/storage/session-view-preferences.ts","lineNumber":142,"sourceCode":"  await overrideUpdateBarriers.get(key)\n  return readSessionViewOverridesStorage(key)\n}\n\n/** Persists one user mutation without replacing sibling overrides from another mount. */\nexport async function updateSessionViewOverride(\n  hostId: string,\n  worktreeId: string,\n  tabId: string,\n  view: MobileSessionView\n): Promise<void> {\n  const key = sessionViewOverridesKey(hostId, worktreeId)\n  const previous = overrideUpdateBarriers.get(key) ?? Promise.resolve()\n  const update = previous.then(async () => {\n    const current = await readSessionViewOverridesStorage(key)\n    // Why: a transient read failure must not replace valid saved siblings with\n    // a partial map containing only the latest tab.\n    if (!current.loaded) {\n      throw new Error('Session view overrides could not be read')\n    }\n    current.overrides.set(tabId, view)\n    await AsyncStorage.setItem(key, JSON.stringify(Object.fromEntries(current.overrides)))\n  })\n  const barrier = update.catch(() => undefined)\n  overrideUpdateBarriers.set(key, barrier)\n  try {\n    await update\n  } finally {\n    if (overrideUpdateBarriers.get(key) === barrier) {\n      overrideUpdateBarriers.delete(key)\n    }\n  }\n}\n","sourceCodeStart":124,"sourceCodeEnd":157,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/storage/session-view-preferences.ts#L124-L157","documentation":"Thrown by `updateSessionViewOverride` when the prerequisite read of existing overrides fails. `readSessionViewOverridesStorage` returns `loaded: false` only when `AsyncStorage.getItem` itself throws; the update then refuses to proceed because writing a single-tab map would overwrite the other tabs' valid saved overrides with an incomplete snapshot. The shared `overrideUpdateBarriers` chain serialises writes per host/worktree key.","triggerScenarios":"Toggling a tab's session view (terminal↔chat) where reading the current overrides map from AsyncStorage throws — native storage I/O error, disk full, keychain/storage backend unavailable on the OS.","commonSituations":"Disk pressure or filesystem error on the device; AsyncStorage backend corruption; an OS-level permission issue accessing the app's storage sandbox; a transient I/O fault during heavy memory pressure.","solutions":["Retry the toggle — transient storage I/O often succeeds on the next attempt.","Free device storage / restart the app to clear a transient AsyncStorage fault.","If it persists, the storage backend may need the app's cache cleared (data itself is safe to lose for view preferences).","Verify no other code is holding/corrupting the `orca:nativeChatTabs:` key namespace."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// updateSessionViewOverride already serialises via overrideUpdateBarriers and\n// swallows the barrier rejection; callers should retry on transient I/O failure.\ntry {\n  await updateSessionViewOverride(hostId, worktreeId, tabId, view)\n} catch (err) {\n  if (err instanceof Error && err.message === 'Session view overrides could not be read') {\n    await wait(200)\n    await updateSessionViewOverride(hostId, worktreeId, tabId, view)\n  } else throw err\n}","preventionTips":["Never overwrite the overrides map when the read failed — it would erase sibling tabs (the guard enforces this).","Retry transient AsyncStorage I/O rather than dropping sibling overrides.","Keep the overrideUpdateBarriers chain intact so concurrent mounts don't interleave reads/writes."],"tags":["storage","async-storage","preferences","session-view"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}