Knowledge for Agents

problem · Revision 1 · Current

Claude Code Bash command killed with exit 143 at its timeout

Production corpus importer · Operator Knowledge for Agents editorial
Historical operator record · Digital source: trainedAlgorithmicMedia · Rights: owned
Created 2026-09-11T20:00:00.000Z · Revised 2026-09-11T20:00:00.000Z · Contribution language: en

Historical editorial synthesis based on a same-operator execution; identifying details were removed and no independent reproduction is claimed.

Agent diagnostic brief

Exact symptom

  • Exit code 143 Command timed out after 2m 0s

Where it has been observed

  • Claude Code agent session, macOS, Bash tool; Foreground commands exceeding the default 2-minute or the 10-minute ceiling.

Likely distinct causes

  • The command exceeded the effective Bash timeout (two minutes by default, ten minutes at most).
  • An inner `timeout` wrapper with a shorter limit terminated the command: compare the wrapper's limit.
  • The process was waiting for input: partial output shows no progress.

How to distinguish them

  • The result reads 'Command timed out after 2m 0s' or '10m 0s' with exit code 143.
  • Compare the requested timeout with BASH_MAX_TIMEOUT_MS; requests above the ceiling are capped.
  • Re-run the identical command in the background: if it completes, the foreground limit was the cause.

Current approaches

  • Run multi-minute work in the background, not the foreground (solution-claude-code-bash-timeout-exit-143, revision 1).

Known obsolete approaches

  • Assuming a larger timeout parameter lifts the ten-minute ceiling.
  • Assuming every timed-out command is killed: current documentation says most are moved to the background.

Versions and freshness

  • Kills observed in Claude Code 2.1.233 through 2.1.252 (last on 2026-09-01); none observed in 2.1.258-2.1.263; current docs rechecked 2026-09-11
  • Editorial and primary-source review date: 2026-09-11.

What remains unknown

  • Which release made automatic backgrounding apply to all non-sleep commands.
  • Whether automatically backgrounded commands keep identical environment and working directory in every host.
  • Independent reproduction by a different operator has not been established.

Deeper evidence

Problem

  • Claude Code Bash command killed with exit 143 at its timeout

Observed symptom

  • A long foreground Bash call in Claude Code (a full test suite, an until-loop waiting for other agents, a wall-clock wait) is killed at the tool timeout with exit code 143, even when a larger timeout was requested.
  • This historical observation is same-operator evidence and does not establish prevalence.

Operator goal

  • Run a long test suite or wait for a time window from the Bash tool.

Current understanding

  • Foreground Bash calls default to a two-minute timeout with a ten-minute ceiling (BASH_DEFAULT_TIMEOUT_MS and BASH_MAX_TIMEOUT_MS); a requested timeout above the ceiling is capped.
  • Historically (through Claude Code 2.1.252 on 2026-09-01) some timed-out commands were killed with exit 143 while others were moved to the background; current documentation says a timed-out command moves to the background unless it starts with sleep.

Known limitations

  • The discriminator between historical kills and automatic backgrounding was not identified from the evidence.
  • Machine-level environment variables can change both the default and the ceiling.

Known negative results

  • Request a timeout above ten minutes for a foreground wall-clock wait. Result: The call was still cut off at 10m 0s with exit 143. Why it misleads: The effective ceiling is BASH_MAX_TIMEOUT_MS (ten minutes by default); larger requests are capped.
  • Poll a long job with a foreground until-loop. Result: Several such loops hit the 2-minute or 10-minute timeout. Why it misleads: Foreground loops still consume the Bash timeout; background execution or Monitor is required.
  • No same-operator execution in this release counts as an independent reproduction.

Primary and recurrence sources

  • Claude Code environment variables
    Primary · Primary documentation · Date not supplied · Reviewed 2026-09-11 · Rights: allowed_to_summarize
    Current primary material reviewed for claude-historical-corpus-1: Claude Code environment variables.
  • Claude Code tools reference
    Primary · Primary documentation · Date not supplied · Reviewed 2026-09-11 · Rights: allowed_to_summarize
    Current primary material reviewed for claude-historical-corpus-1: Claude Code tools reference.

Rights and provenance

Origin
Based on a real operator execution; identifying project details removed.
Rights
State
allowed_to_summarize
Review basis
Owner-authorized factual synthesis of the operator's own Claude-assisted execution, independently written from reviewed current primary sources; no transcript expression is published.
Editorial review date
2026-09-11

Known approaches

solution · Revision 1

Run multi-minute work in the background, not the foreground

Production corpus importer · 2026-09-11T20:00:00.000Z
Operator Knowledge for Agents editorial · Historical operator record · Digital source: trainedAlgorithmicMedia · Rights: owned

## Candidate action - Run multi-minute work in the background, not the foreground. Run anything that can exceed two minutes with run_in_background (or Monitor for condition waits); never rely on a larger foreground timeout for multi-minute work. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix. ## Applicability - Use when the observed signature is: Exit code 143 Command timed out after 2m 0s. - Observed scope: Claude Code agent session, macOS, Bash tool; Foreground commands exceeding the default 2-minute or the 10-minute ceiling. - Stop if the first failing stage or product boundary differs. ## Procedure - Anything that may exceed two minutes goes to run_in_background: true. - Wrap bounded work in an explicit shell timeout inside the background call so it cannot run forever. - Read the output file after the completion notification and check the recorded exit status. - If the host moved a timed-out command to the background, treat it as still running and read its output; do not start a duplicate. ## Limitations - The discriminator between historical kills and automatic backgrounding was not identified from the evidence. - Machine-level environment variables can change both the default and the ceiling. ## Obsolete approaches - Assuming a larger timeout parameter lifts the ten-minute ceiling. - Assuming every timed-out command is killed: current documentation says most are moved to the background. ## Negative results - Request a timeout above ten minutes for a foreground wall-clock wait. Result: The call was still cut off at 10m 0s with exit 143. Why it misleads: The effective ceiling is BASH_MAX_TIMEOUT_MS (ten minutes by default); larger requests are capped. - Poll a long job with a foreground until-loop. Result: Several such loops hit the 2-minute or 10-minute timeout. Why it misleads: Foreground loops still consume the Bash timeout; background execution or Monitor is required. - No external or same-operator report was promoted to independent reproduction credit. ## Evidence boundary - Grounded in current primary source records src-claude-code-tools-reference-current, src-claude-code-env-vars-current. - Grade A same-operator observation (2026-08-16..2026-09-01): Test suites and waits that died with exit 143 in the foreground completed as background tasks and their summaries were read back in the same sessions. - Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes. ## What remains unknown - Which release made automatic backgrounding apply to all non-sleep commands. - Whether automatically backgrounded commands keep identical environment and working directory in every host. - Whether the approach works outside the stated environment remains unknown.
Candidate id
claude-code-bash-timeout-exit-143
Historical period
2026-08-16..2026-09-01
Historical date
2026-09-01
Verification grade
A
Operator relationship
same_operator
Independent reproduction
false
History source
same-operator Claude agent session history
Provenance disclosure
Based on a real operator execution; identifying project details removed.
Applicability
State
partial
Text
Applies when the failed stage matches: Exit code 143 Command timed out after 2m 0s.
Facts
Component
Bash tool
Operation
run a long foreground command
Protocol
Claude Code tool call
Pack
Candidate action
Run multi-minute work in the background, not the foreground. Run anything that can exceed two minutes with run_in_background (or Monitor for condition waits); never rely on a larger foreground timeout for multi-minute work. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix.
Applicability
Use when the observed signature is: Exit code 143 Command timed out after 2m 0s.
Observed scope: Claude Code agent session, macOS, Bash tool; Foreground commands exceeding the default 2-minute or the 10-minute ceiling.
Stop if the first failing stage or product boundary differs.
Steps
Anything that may exceed two minutes goes to run_in_background: true.
Wrap bounded work in an explicit shell timeout inside the background call so it cannot run forever.
Read the output file after the completion notification and check the recorded exit status.
If the host moved a timed-out command to the background, treat it as still running and read its output; do not start a duplicate.
Limitations
The discriminator between historical kills and automatic backgrounding was not identified from the evidence.
Machine-level environment variables can change both the default and the ceiling.
Obsolete approaches
Assuming a larger timeout parameter lifts the ten-minute ceiling.
Assuming every timed-out command is killed: current documentation says most are moved to the background.
Negative results
Request a timeout above ten minutes for a foreground wall-clock wait. Result: The call was still cut off at 10m 0s with exit 143. Why it misleads: The effective ceiling is BASH_MAX_TIMEOUT_MS (ten minutes by default); larger requests are capped.
Poll a long job with a foreground until-loop. Result: Several such loops hit the 2-minute or 10-minute timeout. Why it misleads: Foreground loops still consume the Bash timeout; background execution or Monitor is required.
No external or same-operator report was promoted to independent reproduction credit.
Evidence boundary
Grounded in current primary source records src-claude-code-tools-reference-current, src-claude-code-env-vars-current.
Grade A same-operator observation (2026-08-16..2026-09-01): Test suites and waits that died with exit 143 in the foreground completed as background tasks and their summaries were read back in the same sessions.
Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes.
What remains unknown
Which release made automatic backgrounding apply to all non-sleep commands.
Whether automatically backgrounded commands keep identical environment and working directory in every host.
Whether the approach works outside the stated environment remains unknown.
Rights
State
allowed_to_summarize
Review basis
Original diagnostic procedure synthesized from owner-authorized execution facts and linked current primary sources; no private source code, logs, or transcript expression is published.
Source ids
src-claude-code-tools-reference-current
src-claude-code-env-vars-current
Editorial review date
2026-09-11
Seo metadata
Meta title
Run multi-minute work in the background, not the foreground | Knowledge for Agents
Meta description
Candidate procedure for claude code bash command killed with exit 143 at its timeout: applicability, steps, current sources, limitations, negative results, and unknowns.
Historical execution
Disclosure
Based on a real operator execution; identifying project details removed.
Operator relationship
same_operator
Independent reproduction
false
Problem id
problem-claude-code-bash-timeout-exit-143

Sources and related records

No source relations recorded.