openclaw/openclaw · warning · CatalogParamsError

Codex session is active in this App Server; wait for it to f

Error message

Codex session is active in this App Server; wait for it to finish before ${action === "continue" ? "starting a branch" : "archiving"}

What it means

Thrown by requireIdleThread when a thread's status.type is 'active' and the caller is trying to either continue (start a branch) or archive it. The message is parameterized: 'starting a branch' for continue, 'archiving' for archive. This is a transient, expected guard — the thread is genuinely busy and the operation must wait for the run to settle.

Source

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

  return {
    hostId: params.hostId,
    label: nodeLabel(node),
    threadId: params.threadId,
    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);
}

View on GitHub (pinned to 01804a7531)

Solutions

  1. Wait for the active run to finish, then re-read thread status (control.readThread) and retry the continue/archive.
  2. Surface a 'session busy, retry shortly' message in the UI and poll status until it returns idle.
  3. Ensure the UI only offers canContinue/canArchive when the latest status read is idle/notLoaded (toGenericCatalogHost already gates these on continuableStatus).
  4. Avoid issuing continue/archive from automation without first confirming idle status.

Example fix

// before: acting on possibly-stale status
requireIdleThread(thread, 'archive');
// after: re-read then act
const fresh = await control.readThread(threadId, false);
if (fresh.status?.type === 'active') throw new Error('busy, retry');
requireIdleThread(fresh, 'archive');
Defensive patterns

Strategy: retry

Validate before calling

const fresh = await control.readThread(threadId, false);
if (fresh.status?.type === 'active') {
  // wait and retry, or surface 'busy' to the user
}

Type guard

function isIdleFor(t: { status?: { type?: string } }, action: 'continue' | 'archive'): boolean {
  return t.status?.type === 'idle' || (action === 'archive' && t.status?.type === 'notLoaded');
}

Try / catch

try {
  requireIdleThread(thread, 'archive');
} catch (e) {
  if (e instanceof CatalogParamsError && /active in this App Server/.test(e.message)) {
    await waitForIdle(threadId); await retry();
  }
  throw e;
}

Prevention

When it happens

Trigger: requireIdleThread(thread, action) is called with thread.status.type === 'active' (a harness run is in progress on that App Server). Reached from continueLocalCodexSessionInner (continue) or archiveLocalCodexSession (archive) after a fresh status read.

Common situations: User clicks Continue/Archive in the UI while a Codex run is mid-execution; a previous run has not reported terminal status; UI status cache is stale so the action was offered prematurely; long-running turn that has not flushed idle status.

Related errors


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