Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/acp-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,7 @@ export class ClaudeAcpAgent implements Agent {
...userProvidedOptions,
env: {
...process.env,
CLAUDECODE: "", // Prevent nested-session detection when spawned from within Claude Code
...userProvidedOptions?.env,
...createEnvForGateway(this.gatewayAuthMeta),
},
Expand Down Expand Up @@ -1303,11 +1304,19 @@ export class ClaudeAcpAgent implements Agent {
initializationResult = await q.initializationResult();
} catch (error) {
if (
creationOpts.resume &&
error instanceof Error &&
error.message === "Query closed before response received"
) {
throw RequestError.resourceNotFound(sessionId);
if (creationOpts.resume) {
throw RequestError.resourceNotFound(sessionId);
}
// For new sessions, provide a meaningful error instead of generic "Internal error"
throw RequestError.internalError(
undefined,
"Claude Code process exited before initialization completed. " +
"Ensure Claude Code is installed and accessible. " +
"You can set CLAUDE_CODE_EXECUTABLE to the path of the Claude CLI.",
);
}
throw error;
}
Expand Down