Skip to content

fix: recognize Cursor session-not-found error format#162

Open
log-li wants to merge 1 commit intoopenclaw:mainfrom
log-li:fix/cursor-session-not-found
Open

fix: recognize Cursor session-not-found error format#162
log-li wants to merge 1 commit intoopenclaw:mainfrom
log-li:fix/cursor-session-not-found

Conversation

@log-li
Copy link

@log-li log-li commented Mar 18, 2026

Summary

Cursor CLI returns error code -32602 with message Session "xxx" not found when session/load fails. This format was not recognized by isSessionNotFoundText(), preventing fallback to session/new.

Problem

When OpenClaw tries to spawn a Cursor ACP session using sessions_spawn(runtime="acp", agentId="cursor"), the following error occurs:

Invalid params - Session "xxx" not found

The root cause is that Cursor's error message format Session "xxx" not found contains the session ID in the middle, so "session not found" is not a substring.

Solution

Added regex pattern to match Session "xxx" not found format:

const SESSION_NOT_FOUND_PATTERN = /session\s+["'\w\-]+\s+not found/i;

Testing

  • ✅ Unit tests pass (254 tests, 0 failures)
  • ✅ Verified with real Cursor CLI error format
  • ✅ End-to-end test with OpenClaw sessions_spawn successful

Fixes #161

Cursor CLI returns error code -32602 with message 'Session "xxx" not found'
when session/load fails. This format was not recognized by isSessionNotFoundText(),
preventing fallback to session/new.

Added regex pattern to match 'Session "xxx" not found' format:
- /session\s+["'\w\-]+\s+not found/i

Fixes openclaw#161
@wisdomdaoleo

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursor ACP session/load fallback not triggered due to unrecognized error code

3 participants