EPIPE Error Handling for Piped Output #
What
Claude Code now gracefully handles broken pipe (EPIPE) errors when output is piped to another process that closes early.
Usage
claude -p "list files" | head -1 # No longer crashes if head closes early
Details
- Prevents crashes when Claude Code's output is piped to a process that terminates before reading all output
- Automatically destroys stdout/stderr streams on EPIPE instead of throwing an uncaught error
- Improves CLI scripting reliability
Evidence
HS0() at line 519 (EPIPE handler, contains "EPIPE")
Enterprise MCP Exclusive Mode #
What
Enterprises can now configure MCP servers in exclusive mode, preventing users from adding custom MCP servers.
Usage: Configured via enterprise policy. When active, users see:
Cannot add MCP server: enterprise MCP configuration is active and has exclusive control over MCP servers
Details
- Allows enterprises to lock down MCP server configuration
- Users cannot add MCP servers via
/mcp command or config files when active - Provides clear error messaging about why server addition is blocked
Evidence
jd() at line 398745 (MCP server add function, contains "enterprise MCP configuration is active and has exclusive control over MCP servers")
Custom Betas Validation for API Users #
What
API key users can now specify custom beta headers, with validation against an allowlist.
Details
- Only the
context-1m-2025-08-07 beta is currently allowed - Warnings are shown for disallowed beta headers
- OAuth users cannot use custom betas (server-controlled)
Evidence
JrQ() at line 140738 (beta validation, contains "Custom betas are only available for API key users")
Slow Operation Detection and Diagnostics #
Performance monitoring has been added for operations that may cause UI lag or delays:
JSON.stringify, JSON.parse, and structuredClone operations now log warnings when they take >200msfs.writeFileSync operations include size information in slow operation warningsexecSync shell commands are monitored for slow execution- All slow operations are reported via telemetry for aggregate analysis
Evidence
duA() at line 3224 (slow operation wrapper, contains "[SLOW OPERATION DETECTED]")
OAuth 401 Error Recovery #
What
OAuth authentication now attempts to recover from 401 errors by re-reading credentials from the system keychain.
Details
- When a 401 error occurs, Claude Code checks if the keychain has newer credentials
- If different credentials are found, they're used without requiring re-authentication
- Reduces unnecessary login prompts when tokens are refreshed externally
- Telemetry event:
tengu_oauth_401_recovered_from_keychain
Evidence
C1B() at line 146443 (OAuth recovery, contains "tengu_oauth_401_recovered_from_keychain")
Claude Sonnet 4 with 1M Context Beta Support #
What
The max tokens calculation now correctly handles Claude Sonnet 4 models using the 1M context beta.
Details
- Previously only models with
[1m] in the name got 1M max tokens - Now also applies when
context-1m-2025-08-07 beta header is used with claude-sonnet-4 models - Enables proper token limits for Sonnet 4 + 1M context combinations
Evidence
R$() at line 1818 (max tokens calculation, contains "claude-sonnet-4" and T8A)
Filesystem Operations Logging Improvements #
What
All filesystem operations now include descriptive context in debug logs.
Details
- Operations like
readFileSync, writeFileSync, symlinkSync now log with path information - Improved format:
readFileSync(/path/to/file) instead of just readFileSync - Helps diagnose file-related issues in debug mode
Evidence
CQ variable at line 2388 (filesystem wrapper, contains descriptive operation strings)
What
Added function to cleanly remove plugin-sourced hooks while preserving non-plugin hooks.
Details
sy0() function filters out hooks that have a pluginRoot property- Enables proper plugin unloading without affecting built-in hooks
- Improves plugin lifecycle management
Evidence
sy0() at line 2270 (plugin hooks cleanup, filters by "pluginRoot")
Configurable Timeout Validator #
What
New timeout configuration validator with sensible defaults and caps.
Details
- Default: 30000ms (30 seconds)
- Maximum: 150000ms (2.5 minutes)
- Invalid values fall back to default with a warning
- Values exceeding maximum are capped with a notice
Evidence
sx0() at line 1741 (timeout validator, contains "Invalid value", "Capped from")