{"record":{"id":"f0ebd7711fb7ffa9","repo":"openclaw/openclaw","slug":"codex-thread-loaded-list-returned-repeated-cursor","errorCode":null,"errorMessage":"Codex thread/loaded/list returned repeated cursor ${nextCursor}","messagePattern":"Codex thread/loaded/list returned repeated cursor (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/codex/src/supervision-tools.ts","lineNumber":601,"sourceCode":"    for (const threadId of threadIds) {\n      if (sessions.some((entry) => entry.threadId === threadId)) {\n        continue;\n      }\n      try {\n        const thread = await readThread({ request, endpoint, threadId, includeTurns: false });\n        const session = toSession(endpoint.id, thread, true);\n        if (session) {\n          sessions.push(session);\n        }\n      } catch (error) {\n        if (!isLoadedThreadReadMiss(error)) {\n          throw error;\n        }\n      }\n    }\n    const nextCursor = readCompatNextCursor(listed.nextCursor, \"thread/loaded/list\");\n    if (nextCursor && seenCursors.has(nextCursor)) {\n      throw new Error(`Codex thread/loaded/list returned repeated cursor ${nextCursor}`);\n    }\n    if (nextCursor) {\n      seenCursors.add(nextCursor);\n    }\n    cursor = nextCursor;\n    if (!cursor) {\n      break;\n    }\n  }\n  if (cursor) {\n    throw new Error(\n      `Codex thread/loaded/list exceeded ${MAX_COMPAT_PAGINATION_PAGES} pages with a continuation cursor`,\n    );\n  }\n  return sessions;\n}\n\nasync function listStoredSessions(params: {","sourceCodeStart":583,"sourceCodeEnd":619,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/codex/src/supervision-tools.ts#L583-L619","documentation":"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.","triggerScenarios":"The app-server returns the same cursor string on two consecutive (or non-consecutive) pages of thread/loaded/list.","commonSituations":"Buggy app-server pagination; cursor not advancing because underlying data is not changing; proxy caching a paginated response.","solutions":["Update the Codex app-server.","Reduce concurrent load on the app-server (it may return stale cursors under contention).","Report the bug with the exact cursor value (included in the message)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await codexSessionsList();\n} catch (error) {\n  if (error instanceof Error && error.message.includes(\"returned repeated cursor\")) {\n    // app-server pagination bug; report the cursor value, optionally retry once\n  } else {\n    throw error;\n  }\n}","preventionTips":["Report repeated-cursor bugs to the app-server maintainer with the cursor string.","Update the app-server before filing new reports."],"tags":["codex","app-server","pagination","infinite-loop-guard"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}