KBCodeKB
Unverified

Fix 'No Assistant Message Found' Error and JSON Parse Failure in Claude Code When Using @-Sign Directory References

Claude Code versions 2.0.22 through 2.0.26 crash with 'No assistant message found', 'Tool LS not found', and 'SyntaxError: Expected property name or '}' in JSON' errors when using @-sign directory references (e.g., '@docs/', '@src/') in prompts. The root cause is malformed JSON/truncated assistant messages in the CLI bundle when processing @-prefixed directory paths, causing cascading internal parsing failures. Fixed in v2.0.27 (Oct 24, 2025).

Symptoms

  • Error: 'No assistant message found' with cascading async rejection stack trace
  • Error: 'Tool LS not found' appearing after the initial crash
  • SyntaxError: Expected property name or '}' in JSON at position 1
  • Request aborted error following the JSON parse failure
  • Session crashes immediately after first message when @-sign directory references are used
  • Errors persist across Claude Code versions 2.0.22, 2.0.24, 2.0.25, and 2.0.26

Error signatures

Error: No assistant message found
Error: Tool LS not found
SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)
Error: Request was aborted

Possible causes

  • Using @-sign syntax to reference directories (e.g., '@docs/reference/', '@src/components/') instead of individual files causes the Claude Code CLI bundle to produce truncated or malformed JSON messages
  • The CLI's internal message parsing layer fails when @-prefixed directory paths resolve to large file trees, producing incomplete assistant message structures
  • The JSON.parse() call in the CLI bundle encounters unexpected characters/truncation when processing multi-file @-directory responses, triggering the cascading 'No assistant message found' → 'Tool LS not found' error chain
  • Regression introduced in v2.0.22 (Oct 17, 2025) — v2.0.21 and earlier do not exhibit the bug

Solutions

Downgrade to Claude Code v2.0.21 (Last Known Good Version)

risk: lowgithubpublished

If you cannot use ./ paths and cannot immediately upgrade to ≥ 2.0.27, revert to v2.0.21 which does not have the bug. This was confirmed by multiple community members as the last-known-good version.

  1. Uninstall current version: `npm uninstall -g @anthropic-ai/claude-code`
  2. Install v2.0.21: `npm install -g @anthropic-ai/claude-code@2.0.21`
  3. Pin the version to prevent auto-update: add version constraint to your package.json or install script
  4. Verify: `claude --version` should show '2.0.21'

Commands

npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code@2.0.21
claude --version

Risks

  • v2.0.21 is outdated and missing security patches and features released after Oct 16, 2025
  • Auto-update may override the pinned version — use npm version pinning to prevent this

Verification

  • Step 1: Run `claude --version` → expect: '2.0.21'
  • Step 2: Start a Claude Code session and use @-sign directory references → expect: normal operation without the error
0 verified0 failed

Use ./ Relative Path Instead of @-Sign Directory References (Workaround)

risk: lowgithubpublished

Replace @-sign directory references with standard ./ relative paths in your prompts. The bug only affects @-prefixed directory syntax, not standard file system paths.

  1. Instead of: 'review @docs/reference/claude-code/'
  2. Use: 'review ./docs/reference/claude-code/'
  3. Or reference individual files: 'review @docs/reference/claude-code/hooks.md'
  4. Avoid @directory/ patterns entirely until you can upgrade

Risks

  • Claude Code must discover files from context rather than using explicit @-references, which may reduce accuracy for large codebases
  • Temporary workaround only — upgrade is the permanent fix

Verification

  • Step 1: Start a Claude Code session with v2.0.22–2.0.26
  • Step 2: Send a prompt using './some_directory/' instead of '@some_directory/' → expect: normal response without errors
0 verified0 failed

Upgrade to Claude Code v2.0.27 or Later (Official Fix)

risk: lowofficialpublished

The bug was acknowledged by Anthropic staff and fixed in v2.0.27 (published Oct 24, 2025). Upgrade to any version ≥ 2.0.27 to permanently resolve the issue.

  1. Check your current version: `claude --version`
  2. Upgrade: `npm install -g @anthropic-ai/claude-code@latest`
  3. Verify the fix: `claude --version` should show ≥ 2.0.27
  4. Test: run `claude` and use `@some_directory/` in a prompt — the error should no longer occur

Commands

npm install -g @anthropic-ai/claude-code@latest
claude --version
npm view @anthropic-ai/claude-code version

Risks

  • None — this is the official fix from the maintainers

Verification

  • Step 1: Run `npm view @anthropic-ai/claude-code version` → expect: version ≥ '2.0.27'
  • Step 2: Run `claude --version` → expect output containing '2.0.27' or higher with no error
  • Step 3: Start a Claude Code session and send a prompt with @-sign directory reference (e.g., '@src/') → expect: normal response without 'No assistant message found' error
0 verified0 failed

Agent JSON

Canonical machine-readable representation of this issue:

{
  "issue_id": "859841fc-db18-4e80-924b-c46b8472a4a4",
  "slug": "fix-no-assistant-message-found-error-and-json-parse-failure-in-claude-code-when-using-sign-directory-references-uvrnif",
  "verification_status": "unverified",
  "canonical_json": "https://codekb.dev/v1/issues/fix-no-assistant-message-found-error-and-json-parse-failure-in-claude-code-when-using-sign-directory-references-uvrnif"
}
← Back to all issuesPowered by CodeKB