openclaw/openclaw · error · CatalogParamsError

Codex session cannot be archived in its current state

Error message

Codex session cannot be archived in its current state

What it means

Thrown by requireIdleThread when action is 'archive' and the thread status.type is neither 'idle', 'notLoaded' (the two acceptable archive states), nor 'active' (which has its own dedicated message). It covers any unrecognized or intermediate status — a defensive catch-all so the archive path does not proceed against an unexpected App Server state.

Source

Thrown at extensions/codex/src/session-catalog.ts:836

    items: flattenTranscriptPageDesc(page),
    ...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),
    ...(page.backwardsCursor ? { backwardsCursor: page.backwardsCursor } : {}),
  };
}

function requireIdleThread(thread: CodexThread, action: "continue" | "archive"): void {
  if (
    thread.status?.type === "idle" ||
    (action === "archive" && thread.status?.type === "notLoaded")
  ) {
    return;
  }
  if (thread.status?.type === "active") {
    throw new CatalogParamsError(
      `Codex session is active in this App Server; wait for it to finish before ${action === "continue" ? "starting a branch" : "archiving"}`,
    );
  }
  throw new CatalogParamsError(
    action === "archive"
      ? "Codex session cannot be archived in its current state"
      : "Codex session cannot start a branch in its current state",
  );
}

function adoptionSessionKey(threadId: string): string {
  const digest = createHash("sha256").update(threadId).digest("hex");
  return `${CODEX_SUPERVISION_SESSION_KEY_PREFIX}${digest}`;
}

function isAdoptionSessionKeyForThread(sessionKey: string, threadId: string): boolean {
  return adoptionSessionKeyRest(sessionKey) === adoptionSessionKey(threadId);
}

type CodexSupervisionMarker = { sourceThreadId: string };

async function listAdoptedSessionEntries(params: {

View on GitHub (pinned to 01804a7531)

Solutions

  1. Re-read the thread status (control.readThread) and inspect status.type; wait for it to settle into idle/notLoaded before archiving.
  2. Upgrade the plugin to a version that understands the new status type returned by the app-server.
  3. If status.type is unexpected/undefined, treat the thread as non-archivable and report the raw status for diagnostics.
  4. Confirm @openai/codex version pin matches the running app-server.
Defensive patterns

Strategy: try-catch

Validate before calling

const fresh = await control.readThread(threadId, false);
if (fresh.status?.type !== 'idle' && fresh.status?.type !== 'notLoaded') {
  // do not attempt archive; report raw status
}

Type guard

function isArchivable(t: { status?: { type?: string } }): boolean {
  return t.status?.type === 'idle' || t.status?.type === 'notLoaded';
}

Try / catch

try { requireIdleThread(thread, 'archive'); } catch (e) { if (e instanceof CatalogParamsError && /cannot be archived/.test(e.message)) reportUnexpectedStatus(thread.status); throw e; }

Prevention

When it happens

Trigger: requireIdleThread(thread, 'archive') with thread.status.type being some value other than idle/notLoaded/active (e.g. a future status enum, undefined status, or a state the plugin does not know how to handle).

Common situations: Codex app-server introduced a new status.type this plugin version does not recognize; thread.status is undefined/malformed; archive attempted during an intermediate transition state the plugin maps to neither active nor idle.

Related errors


AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12). Data as JSON: /api/errors/6530587af3ddc198. Report an issue: GitHub.