[Bug] Anthropic API Error: Context limit reached with background Agent sub-skill invocation
Resolved 💬 3 comments Opened Mar 18, 2026 by bang9 Closed Mar 21, 2026
Bug Description
When calling a Skill that invokes a sub-agent in the background, a “Context limit reached” error occurs (even though the limit hasn’t actually been reached). Afterward, if asked why it failed, it then executes successfully.
<img width="715" height="735" alt="Image" src="https://github.com/user-attachments/assets/323ca994-67b3-4e97-9073-791c4d755eb8" />
model: opus4.6[1m]
skill:
---
description: Run format, build, build:cdn, and test checks in parallel. Use after completing code changes to verify everything passes.
model: haiku
allowed-tools: Agent
run_in_background: true
---
Run the repo verification suite after code changes using a background Agent.
Launch a single background Agent (run_in_background: true, model: haiku) with the following prompt:
<prompt>
IMPORTANT: Do NOT explore the codebase, read files, or do anything other than running the four commands below. Only run the commands and report results.
Run these four Bash commands in parallel (all in a single message, do NOT use run_in_background for the Bash calls):
1. `pnpm format:fix` (timeout: 180s)
2. `pnpm build` (timeout: 180s)
3. `pnpm build:cdn` (timeout: 180s)
4. `pnpm test` (timeout: 180s)
Wait for all four to complete, then return ONLY this table and nothing else:
| Task | Result |
| ---------- | --------- |
| format:fix | pass/fail |
| build | pass/fail |
| build:cdn | pass/fail |
| test | pass/fail |
If any check fails, include only the "RAW error output" below the table.
Do NOT add any other commentary or exploration.
</prompt>
When the background Agent completes, relay its result to the user as-is.
Environment Info
- Platform: darwin
- Terminal: webstorm
- Version: 2.1.77
- Feedback ID: f8488e77-d7cf-4a0c-bd47-4766792262cb
Errors
[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/airenkang/.local/share/claude/versions/2.1.77 (expected in multi-process scenarios)\n at ovT (/$bunfs/root/src/entrypoints/cli.js:2648:2192)\n at uxq (/$bunfs/root/src/entrypoints/cli.js:2648:1336)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-17T16:29:55.523Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:79:13365)\n at emit (node:events:92:22)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:78:3321)\n at request (/$bunfs/root/src/entrypoints/cli.js:81:2467)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-17T16:39:58.029Z"},{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:448:3940)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-18T02:00:09.448Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 203356 tokens > 200000 maximum\"},\"request_id\":\"req_011CZ9jCZBXv5q8xhCHBdH4h\"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:409:9024)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:448:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-18T02:06:49.053Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 203701 tokens > 200000 maximum\"},\"request_id\":\"req_011CZ9jD4KEYSQ8LCfvvphfA\"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:409:9024)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:448:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-18T02:06:56.520Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 204673 tokens > 200000 maximum\"},\"request_id\":\"req_011CZ9jEgxuLNgKxsQXSF89g\"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:409:9024)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:448:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-18T02:07:17.783Z"}]This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗