claude-code - 💡(How to fix) Fix [Bug] Anthropic API Error: Memory optimization issue with Claude Opus 4.7 generated applications [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54217Fetched 2026-04-29 06:33:09
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

[{"error":"RangeError: path should be a path.relative()d string, but got ".."\n at hy_ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12713)\n at Sa (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12890)\n at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:13427)\n at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:14090)\n at ZJ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8163:8757)\n at fg1 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:24220)\n at rt6 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:26499)\n at TEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2132)\n at file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2629\n at NEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:4012)","timestamp":"2026-04-28T07:17:49.116Z"},{"error":"RangeError: path should be a path.relative()d string, but got ".."\n at hy (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12713)\n at Sa (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12890)\n at oq4._test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:13427)\n at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:14090)\n at ZJ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8163:8757)\n at fg1 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:24220)\n at p7z (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:25277)\n at rt6 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:26418)\n at TEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2132)\n at file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2629","timestamp":"2026-04-28T07:18:33.915Z"}]

Root Cause

Bug Description hi guys, i saw that in the last model opus 4.7 i got multiple time issue of memory because the apps done by him was not optimized

Code Example

[{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at hy_ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12713)\n    at Sa (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12890)\n    at oq4._test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:13427)\n    at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:14090)\n    at ZJ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8163:8757)\n    at fg1 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:24220)\n    at rt6 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:26499)\n    at TEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2132)\n    at file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2629\n    at NEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:4012)","timestamp":"2026-04-28T07:17:49.116Z"},{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at hy_ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12713)\n    at Sa (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12890)\n    at oq4._test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:13427)\n    at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:14090)\n    at ZJ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8163:8757)\n    at fg1 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:24220)\n    at p7z (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:25277)\n    at rt6 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:26418)\n    at TEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2132)\n    at file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2629","timestamp":"2026-04-28T07:18:33.915Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description hi guys, i saw that in the last model opus 4.7 i got multiple time issue of memory because the apps done by him was not optimized

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 2.1.112
  • Feedback ID: 3a0ed044-6320-41bc-94fa-fdc33f30f81d

Errors

[{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at hy_ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12713)\n    at Sa (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12890)\n    at oq4._test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:13427)\n    at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:14090)\n    at ZJ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8163:8757)\n    at fg1 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:24220)\n    at rt6 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:26499)\n    at TEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2132)\n    at file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2629\n    at NEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:4012)","timestamp":"2026-04-28T07:17:49.116Z"},{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at hy_ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12713)\n    at Sa (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:12890)\n    at oq4._test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:13427)\n    at oq4.test (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:513:14090)\n    at ZJ (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8163:8757)\n    at fg1 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:24220)\n    at p7z (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:25277)\n    at rt6 (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1027:26418)\n    at TEz (file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2132)\n    at file:///Users/matteo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2901:2629","timestamp":"2026-04-28T07:18:33.915Z"}]

extent analysis

TL;DR

The issue is likely caused by an incorrect path being passed to the path.relative() function, and a workaround may involve verifying the input paths and ensuring they are correctly formatted.

Guidance

  • Verify that the input paths being passed to the path.relative() function are correct and do not contain relative paths like "..".
  • Check the documentation for the path.relative() function to ensure it is being used correctly.
  • Consider adding error handling to catch and handle any errors that may occur when working with file paths.
  • Review the code in the cli.js file at the specified line numbers to identify the root cause of the issue.

Example

No code example is provided as the issue is related to a specific library and file, and without more context, it's difficult to provide a accurate example.

Notes

The issue seems to be related to a specific library (@anthropic-ai/claude-code) and file (cli.js), and without more information about the code and the library, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Verify the input paths and ensure they are correctly formatted, and consider adding error handling to catch and handle any errors that may occur when working with file paths. This is because the issue seems to be related to an incorrect path being passed to the path.relative() function, and verifying the input paths and adding error handling may help to resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Anthropic API Error: Memory optimization issue with Claude Opus 4.7 generated applications [1 comments, 2 participants]