stablyai/orca · error · Error

Orca could not safely move this legacy Codex session into yo

Error message

Orca could not safely move this legacy Codex session into your system Codex home. Retry resume; if it still fails, check that both Codex session folders are readable and writable.

What it means

Thrown (RETRYABLE_RESUME_ERROR) when preparing a legacy shared Codex session resume and the source file's path relative to the managed sessions root does not match the dated rollout layout (YYYY/MM/DD/rollout-*.jsonl[.zst]). isDatedRolloutRelativePath rejected it, so Orca refuses to relocate a file whose location it cannot safely map into the system Codex home.

Source

Thrown at src/main/codex/codex-legacy-session-resume.ts:56

    return { useRealCodexHome: false, substituteCodexHome }
  }
  const paths = resolveCodexSessionBackfillPaths(options.systemCodexHomePath)
  const legacyCodexHomePath = options.legacyCodexHomePath ?? dirname(paths.managedSessionsRoot)
  const managedSessionsRoot = join(legacyCodexHomePath, 'sessions')
  if (
    args.agent !== 'codex' ||
    args.executionHostId !== LOCAL_EXECUTION_HOST_ID ||
    !args.codexHome ||
    !sameRuntimePath(args.codexHome, legacyCodexHomePath) ||
    !options.isHostSystemDefaultRealHome()
  ) {
    return { useRealCodexHome: false }
  }

  const sourcePath = resolve(args.filePath)
  const relativePath = relative(resolve(managedSessionsRoot), sourcePath)
  if (!isDatedRolloutRelativePath(relativePath)) {
    throw new Error(RETRYABLE_RESUME_ERROR)
  }
  const targetPath = join(paths.systemSessionsRoot, relativePath)
  const key = `${normalizeRuntimePathForComparison(sourcePath)}\0${normalizeRuntimePathForComparison(targetPath)}`
  let task = materializations.get(key)
  if (!task) {
    task = materializeLegacyRollout(sourcePath, targetPath, paths.auditLogPath)
    materializations.set(key, task)
    void task.then(
      () => {
        if (materializations.get(key) === task) {
          materializations.delete(key)
        }
      },
      () => {
        if (materializations.get(key) === task) {
          materializations.delete(key)
        }
      }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Confirm args.filePath is under <legacyCodexHomePath>/sessions/YYYY/MM/DD/rollout-*.jsonl(.zst).
  2. If the file was moved, restore it to the dated rollout path the session bridge originally wrote.
  3. Verify args.codexHome and options.legacyCodexHomePath resolve to the same runtime path (sameRuntimePath).
  4. Retry resume once the path is corrected — the message itself says retry is safe.
  5. If the layout is genuinely non-standard, the resume declines gracefully only if isDatedRolloutRelativePath passes; reorganize the file.
Defensive patterns

Strategy: validation

Validate before calling

import { relative, resolve, sep } from 'node:path'
function isDatedRolloutRelativePath(p: string): boolean {
  if (!p || p.startsWith('..') || resolve(p) === p) return false
  const parts = p.split(sep)
  return parts.length === 4 && /^\d{4}$/.test(parts[0]) && /^\d{2}$/.test(parts[1]) && /^\d{2}$/.test(parts[2]) && /^rollout-.+\.jsonl(?:\.zst)?$/.test(parts[3])
}
// Before calling prepareLegacySharedCodexSessionResume:
const rel = relative(resolve(join(legacyCodexHome, 'sessions')), resolve(args.filePath))
if (!isDatedRolloutRelativePath(rel)) {
  // decline resume; don't call the preparer
}

Try / catch

try {
  await prepareLegacySharedCodexSessionResume(args, options)
} catch (error) {
  if (error instanceof Error && error.message === RETRYABLE_RESUME_ERROR) {
    // surface a retry prompt to the user; do not auto-retry in a tight loop
  } else throw error
}

Prevention

When it happens

Trigger: args.filePath lives outside sessions/YYYY/MM/DD/; the relative path escapes the root (starts with '..' or is absolute); the filename doesn't match rollout-*.jsonl or rollout-*.jsonl.zst; the path has the wrong number of segments (not exactly 4).

Common situations: A legacy session file was moved by the user into a non-standard layout; the codexHome path comparison resolved to a different root than expected; a rollout was renamed; the sessions root was restructured.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/c3f8e1ac28a90f17. Report an issue: GitHub.