openclaw/openclaw · error · Error

Codex thread/loaded/list returned repeated cursor ${nextCurs

Error message

Codex thread/loaded/list returned repeated cursor ${nextCursor}

What it means

Thrown by listLoadedSessions when the app-server returns a nextCursor that was already seen earlier in the same pagination loop. This is an infinite-loop guard: a correct server returns fresh cursors on each page.

Source

Thrown at extensions/codex/src/supervision-tools.ts:601

    for (const threadId of threadIds) {
      if (sessions.some((entry) => entry.threadId === threadId)) {
        continue;
      }
      try {
        const thread = await readThread({ request, endpoint, threadId, includeTurns: false });
        const session = toSession(endpoint.id, thread, true);
        if (session) {
          sessions.push(session);
        }
      } catch (error) {
        if (!isLoadedThreadReadMiss(error)) {
          throw error;
        }
      }
    }
    const nextCursor = readCompatNextCursor(listed.nextCursor, "thread/loaded/list");
    if (nextCursor && seenCursors.has(nextCursor)) {
      throw new Error(`Codex thread/loaded/list returned repeated cursor ${nextCursor}`);
    }
    if (nextCursor) {
      seenCursors.add(nextCursor);
    }
    cursor = nextCursor;
    if (!cursor) {
      break;
    }
  }
  if (cursor) {
    throw new Error(
      `Codex thread/loaded/list exceeded ${MAX_COMPAT_PAGINATION_PAGES} pages with a continuation cursor`,
    );
  }
  return sessions;
}

async function listStoredSessions(params: {

View on GitHub (pinned to 01804a7531)

Solutions

  1. Update the Codex app-server.
  2. Reduce concurrent load on the app-server (it may return stale cursors under contention).
  3. Report the bug with the exact cursor value (included in the message).
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await codexSessionsList();
} catch (error) {
  if (error instanceof Error && error.message.includes("returned repeated cursor")) {
    // app-server pagination bug; report the cursor value, optionally retry once
  } else {
    throw error;
  }
}

Prevention

When it happens

Trigger: The app-server returns the same cursor string on two consecutive (or non-consecutive) pages of thread/loaded/list.

Common situations: Buggy app-server pagination; cursor not advancing because underlying data is not changing; proxy caching a paginated response.

Related errors


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