Troubleshooting
Common errors and fixes for Claude Code, Codex CLI, OpenClaw, and external integrations
Overview
A consolidated list of frequent issues and fixes across Claude Code, Codex CLI, OpenClaw, and external integrations — covering installation, authentication, networking, request errors, permissions, caching/billing, plugins, integrations, Codex CLI, and OpenClaw.
Setup guides: CC-Switch Setup, Node.js and Git Setup, Claude Code Setup, Codex CLI Setup.
Before troubleshooting on your own, check whether the issue is widespread in the community channel. If nobody else reports it, the problem is likely local.
Installation and Startup
Q1: First launch fails with "Unable to connect to Anthropic services"
Symptom: After installing Claude Code, the first claude invocation prints the following and exits:
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_BAD_REQUEST
Please check your internet connection and network settings.Fix: Open ~/.claude.json (Windows: C:\Users\<user>\.claude.json) in a text editor and add this field to the top-level JSON object:
"hasCompletedOnboarding": trueFull example:
{
"installMethod": "unknown",
"autoUpdates": true,
"firstStartTime": "2025-07-14T06:11:03.877Z",
"userID": "...",
"projects": { },
"hasCompletedOnboarding": true
}Make sure the closing } of projects is followed by a comma, otherwise the JSON is invalid. Validate the file:
cat ~/.claude.json | python3 -m json.toolNo errors means the format is valid. Re-run claude to enter the interactive UI.
Q2: command not found: claude
The npm global bin directory is not on PATH. Run npm config get prefix and append its /bin directory to the system PATH.
Q3: permission denied / EACCES during install (Mac / Linux)
Don't use sudo. Move the npm global prefix to your home directory:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc # zsh users: ~/.zshrc
source ~/.bashrcQ4: permission denied during install (Windows)
Run PowerShell as Administrator:
npm config set prefix "$env:APPDATA\npm"
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserQ5: How do I remove an older npm install of Claude Code?
The current official recommendation is the native install script, not npm. Back up ~/.claude first, then uninstall the old package:
# Mac / Linux
if [ -d ~/.claude ]; then cp -r ~/.claude ~/.claude.backup; fi
npm list -g --depth=0
npm uninstall -g @anthropic-ai/claude-code# Windows PowerShell
if (Test-Path "$env:USERPROFILE\.claude") { Copy-Item "$env:USERPROFILE\.claude" "$env:USERPROFILE\.claude.backup" -Recurse }
npm list -g --depth=0
npm uninstall -g @anthropic-ai/claude-codeReinstall via the native script:
# Mac / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash# Windows PowerShell
irm https://claude.ai/install.ps1 | iex# Windows CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdOr use a package manager: brew install --cask claude-code on macOS, winget install Anthropic.ClaudeCode on Windows.
Authentication and API Keys
Q6: 401 Invalid API Key / token rejected
Symptom: terminal returns 401 invalid x-api-key.
Cause: ANTHROPIC_BASE_URL is unset or wrong, so the request goes to the official endpoint.
Fix: confirm ~/.claude/settings.json has the correct Base URL and key:
{
"env": {
"ANTHROPIC_BASE_URL": "https://your-api-url",
"ANTHROPIC_API_KEY": "sk-***"
}
}Note: Claude Code's Base URL does not need a /v1 suffix.
Q7: 401 token rejected — IDE or MCP overwrote the config
Symptom: the API key is correct yet 401 persists. Common after installing IDE plugins like Cursor or Continue.
Cause: IDE plugins or MCP servers overwrote apiKey / baseURL in settings.json.
Fix (pick one):
- Recommended: rewrite the config with CC Switch — it overrides whatever was tampered with
- Manual: inspect and fix the overwritten fields in
~/.claude/settings.json - Environment variables: set
ANTHROPIC_BASE_URLandANTHROPIC_API_KEYas system env vars (higher precedence than config files, harder to clobber)
Prevention: re-verify Claude Code connectivity after installing a new IDE plugin or MCP server.
Q8: 401 after switching providers
Symptom: previously used another proxy service; switched, configured the new one correctly, still get 401.
Cause: stale system environment variables from the old service (ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY, ANTHROPIC_API_TOKEN) take precedence over config files.
Windows fix: Win + R → sysdm.cpl → Advanced → Environment Variables. Delete ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY, and ANTHROPIC_API_TOKEN from both User and System scopes. Reopen the terminal. If it still fails, delete these and reconfigure via CC Switch:
C:\Users\<user>\.claude\claude.json
C:\Users\<user>\.claude\claude.json.backupMac / Linux fix: edit ~/.zshrc or ~/.bashrc, remove any lines starting with export ANTHROPIC_, run source ~/.zshrc, restart the terminal.
Q9: OAuth login conflicts with API key
Symptom: previously completed an OAuth login on the official site via claude. After switching to a proxy API, the new config is ignored — requests still go directly to api.anthropic.com. Especially common on servers (CentOS / Ubuntu).
Cause: an OAuth token (primaryApiKey / oauthToken) was written into ~/.claude.json and takes precedence over the API key in settings.json.
Fix:
# Step 1: log out of OAuth
claude auth logout
# Step 2: write the proxy API config
cat > ~/.claude/settings.json << 'EOF'
{
"env": {
"ANTHROPIC_API_KEY": "sk-your-api-key",
"ANTHROPIC_BASE_URL": "https://your-api-url"
}
}
EOF
# Step 3: verify
cat ~/.claude/settings.json
# Step 4: restart
claudePrevention: on servers, write settings.json before the first claude invocation so OAuth never triggers.
Q10: 401 Invalid API Key format — invisible characters in the key
Symptom: the key looks right but still returns 401 or "Invalid format".
Cause: copying the key through PDFs / web pages / screenshots can introduce zero-width spaces, non-breaking spaces, or \r. OCR can also misread 0 vs O or 1 vs l vs I.
Check:
echo "$ANTHROPIC_API_KEY" | cat -A
# OK: line ends with just $
# Bad: ^M$ or other stray charactersFix: re-copy the key using the dashboard's Copy button — never type by hand or route through PDFs / screenshots. Don't wrap the value in quotes:
export ANTHROPIC_API_KEY=sk-ant-api03-your-keyQ11: 403 Missing API Key / config conflict
Cause: config file was modified or multiple configs are colliding.
Fix: use CC Switch to rewrite the config, overwriting any tampered files.
Q12: Launch asks for authentication or shows a login prompt
Make sure ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY are configured, then restart the terminal (close the entire window, not just open a new tab).
Q13: Configuration precedence
Highest to lowest: system environment variables > ~/.claude.json (OAuth token) > ~/.claude/settings.json (written by CC Switch).
If edits to settings.json don't take effect, first check for higher-precedence env vars or leftover OAuth tokens.
Network and Connectivity
Q14: API Error (Connection error.)
Symptom: the request never reaches the server; retries don't help.
Cause: the network path to the server is broken at the TCP layer — usually a dead proxy node, flaky Wi-Fi, or an outbound firewall rule.
Debug steps:
- Run
ping your-api-urlto check reachability - Replies → audit proxy config; timeouts → switch network (different Wi-Fi / disable proxy / change proxy node / phone hotspot)
- Make sure the proxy app has "system proxy" or "TUN mode" enabled — Claude Code is a CLI tool and won't go through browser-only proxy channels
- Once the network is back, re-run
claude
Q15: API Error (Request timed out.)
Symptom: the request hangs and eventually times out.
Two possible causes:
- A — Network latency: latency to the server is too high. Follow Q14.
- B — Context too long: the session has accumulated too many tokens and exceeds the timeout window.
Fix for case B:
- Type
/clearto wipe the conversation - Or
/compactto compress context while keeping a summary - Or exit and re-run
claudefor a fresh session
IDE users: IDE plugins inject heavy system prompts on top of Claude Code's own — the usable conversation budget shrinks fast. Check context length first when you see timeouts.
Q16: WebFetch broken even though the site loads in a browser
Symptom: WebFetch fails on URLs that work fine in the browser, even with a global-mode proxy.
Cause: before fetching the target URL, Claude Code sends a preflight to https://claude.ai/api/web/domain_info. Domestic networks or enterprise firewalls that block claude.ai cause the preflight to fail, which fails WebFetch entirely.
Fix: add this to ~/.claude/settings.json (Windows: C:\Users\<user>\.claude\settings.json):
"skipWebFetchPreflight": trueMerge with existing config:
{
"env": {
"ANTHROPIC_BASE_URL": "https://your-api-url",
"ANTHROPIC_API_KEY": "sk-***"
},
"skipWebFetchPreflight": true
}Restart Claude Code — the preflight is skipped and the target URL is fetched directly.
Request Errors
Q17: Returns 400 unrelated to message content
Symptom: requests to AWS groups return 400 with invalid beta flag in the logs; persists after starting a new conversation.
Cause: Claude Code attaches the experimental anthropic-beta header, which some AWS upstream groups don't support.
Fix: first confirm with an env var:
# Mac / Linux
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
claude# Windows PowerShell
$env:CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = "1"
claudeIf it works, persist the setting in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://your-api-url",
"ANTHROPIC_API_KEY": "sk-***",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
}
}Fully close and reopen the terminal after saving.
Q18: API Error 400 (not content-related)
Cause: a Claude Code bug producing a malformed request body.
Fix: resend, or run /compact — usually clears it.
Q19: 413 Request body too large
Symptom: API Error: 413 Request Entity Too Large.
Cause: too many tokens in the session — request body exceeds the server's body-size limit.
Fix: /clear (wipe) or /compact (summarize), or exit and start a new session.
Prevention: run /compact periodically during long tasks.
Q20: 400 Invalid model name
Symptom: API Error: 400 Invalid model name when using Opus.
Cause: Opus concurrency quota is exhausted; the server rejects with a downgrade.
Fix: don't touch the config — wait a moment and retry. Don't burn time changing settings.
Q21: 429 Rate Limit / quota exhausted
429 comes in two flavors with completely different handling:
rate_limit_error: too many requests per unit time — clears itselfinsufficient_quota: monthly quota exhausted — top up or wait for reset
Determine which: visit https://your-api-url to check balance:
- Balance remaining → rate limit; back off or reduce concurrency
- Balance zero → quota exhausted; top up
Q22: Overloaded / 500
Cause: official service overload or outage.
Fix: check status.anthropic.com and wait for recovery.
Q23: API Error: response exceeded the 32000
Cause: a single reply exceeded the default output token limit.
Fix: in ~/.claude/settings.json under env:
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32000"Q24: 503 model_not_found
Cause: the chosen model is offline or unavailable on the current channel.
Fix: use /model to switch to another available model, or contact the provider to confirm availability.
Q25: Context window exceeded — conversation truncated
Cause: the session has too many tokens; /compact or a new session wasn't run in time.
Fix: run /compact to compress, or /clear to start fresh.
Q26: Command timed out after 2m 0.0s
Cause: Claude Code waited too long for a shell command to return — unrelated to the API.
Fix: run the command manually in your terminal to see where it hangs.
Permissions
Q27: Permission denied — file read/write blocked
Three independent causes — diagnose each:
- A — OS-level permission:
ls -la /path/to/fileto check the mode bits; fix withchmod 644(files) orchmod 755(directories) - B — Claude Code permission setting: you selected "Always deny" for that operation.
Cmd+Shift+P(macOS) orCtrl+Shift+P(Windows/Linux) →Claude: Manage Permissions. Switch the rule to "Ask" or "Allow". - C —
.claudeignoreglob misfire:cat .claudeignoreand look for overly broad patterns. Delete or tighten the offending rule.
Prevention: use precise paths in .claudeignore, not wide globs. Review "Always deny" rules periodically. Keep project files at 644 and directories at 755.
Q28: skipAutoPermissionPrompt breaks Plan mode
Symptom: adding "skipAutoPermissionPrompt": true to settings.json breaks Plan mode; removing it restores it.
Fix: open ~/.claude/settings.json, delete the skipAutoPermissionPrompt line, save, restart the terminal.
Prevention: only add options documented in the official docs. Always sanity-test basic features after changing permission-related settings.
Q29: How does Claude Code's permission system work?
Claude Code asks for confirmation before file operations and shell commands. The first invocation shows a prompt with "Allow once", "Always allow", or "Always deny". A stray "Always deny" silently blocks all future requests in that category — fix it via the Permission manager.
Caching and Billing
Q30: Duplicate cache creation causing duplicate charges
Symptom: within a single request, the cache is created multiple times — billed twice. First-token latency above 30s is a strong tell.
Cause: when a fallback load triggers a key swap, the second forwarded hop carries certain request headers, causing the request to be misrouted and the cache to be recreated.
Fix:
- Confirm the pattern: trace the request path for repeated cache creation and a first-token time noticeably above 30s
- Remove the ccs proxy so the request doesn't traverse the middle layer that triggers the key-swap fallback
- If you must keep the forwarding chain, audit headers preserved in the second hop and drop the ones that cause misrouting
- Send a fresh, isolated request to verify
Prevention: keep the request path stable and singular; only preserve necessary headers when re-forwarding.
Q31: How do I enable 1-hour prompt caching?
For groups that support long caches, add to env in ~/.claude/settings.json:
"ENABLE_PROMPT_CACHING_1H": "1"Trade-off: 1-hour caches are more expensive to rebuild. For high-frequency use the default short cache is usually better. Only enable for long-running tasks.
Q32: How do I see current token usage?
Type /cost in Claude Code to see the current session's token spend.
claude-mem Plugin
Q33: Knowledge base empty, pending_messages piling up
Symptom: observations table is empty (zero knowledge points extracted across many days), pending_messages is full of rows stuck at pending, sdk_sessions has no completed rows, worker_port is None everywhere.
Cause: the model channel the worker uses went offline (e.g. claude-sonnet-4-5 returning 503), the SDK subprocess kept crashing, and the backlog was wiped as "queue garbage" — destroying the source data permanently.
Fix:
- Diagnose before cleaning:
observationsat 0 means the pipeline is broken, not "time to clean up". A pile ofpendingrows is an alarm, not a cleanup signal — investigate the worker, don't delete. - Change the model: edit
~/.claude-mem/settings.jsonand switch to a currently stable model:
{
"CLAUDE_MEM_MODEL": "claude-haiku-4-5-20251001"
}- Restart the worker:
rm ~/.claude-mem/worker.pid— the next hook trigger will restart with the new config. - Safe cleanup: only delete rows in
completedorfailedstate. Never touchpendingrows.
# Safe Python cleanup
cur.execute("DELETE FROM pending_messages WHERE status IN ('completed', 'failed')")
conn.commit()Table cheatsheet:
pending_messages: input queue for knowledge extraction (raw material) — not garbageobservations: extracted knowledge (output) — zero means the pipeline is brokensdk_sessions: subprocess session state — allworker_portNone means it's broken
On Windows running Python, add sys.stdout.reconfigure(encoding='utf-8') or Chinese strings will trigger a GBK error.
Q34: Claude Code commands hang — worker zombie
Symptom: commands return nothing without error; Claude Code gets slower over time. curl http://127.0.0.1:37777/api/health TCP-connects but the HTTP response never comes — the port is in LISTEN state but the owning PID is dead.
Cause: after upgrading claude-mem the old worker died, port 37777 was left in LISTEN with no live process, the new worker keeps misjudging "port in use" and failing, and every tool call's hook times out, dragging the whole CLI.
Check:
curl -m 8 -sv http://127.0.0.1:37777/api/health
# TCP connects but HTTP never returns = zombieFix:
- Clear the leftover process and port
# PowerShell — find the PID listening on the port
Get-NetTCPConnection -LocalPort 37777 | Select-Object OwningProcess
# Kill it
Stop-Process -Id <PID> -ForceIf Stop-Process says the process doesn't exist, kill every leftover node.exe and python.exe from Task Manager.
- Restart the worker from the correct directory
# Correct: the marketplaces directory
cd ~/.claude/plugins/marketplaces/thedotmack
npm run worker:status
npm run worker:restart
# Wrong: don't cd into cache/ — the worker scripts aren't there- Verify
curl -m 5 -sv http://127.0.0.1:37777/api/health
# Normal response: {"status":"ok","initialized":true,"mcpReady":true}Two directories, easy to confuse:
~/.claude/plugins/marketplaces/thedotmack— main plugin dir, holds the worker scripts~/.claude/plugins/cache/thedotmack/claude-mem/<version>/— runtime dependency cache, no worker scripts
Prevention: when Claude Code slows down, check the worker first — not the API or the model. After upgrading claude-mem, actively hit the health endpoint to verify.
External Integrations
Q35: External integration returns 403 block / 403 Forbidden
Check in order:
- The token's group matches the model type
- Base URL is correct — Claude omits
/v1, Codex requires it User-Agentheader is present and matches the model type (don't reuse Claude's UA for Codex)- The client is actually sending the header (some UIs accept input but never transmit it)
Authorizationis still inBearer sk-***format
Q36: User-Agent examples
Claude integrations:
"User-Agent": "claude-cli/2.0.76 (external, cli)"Codex integrations:
"User-Agent": "codex_cli_rs/0.77.0 (Windows 10.0.26100; x86_64) WindowsTerminal"Chinese model integrations (browser-style UA):
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0"Q37: Does the Base URL need /v1?
- Claude integrations (Anthropic Messages protocol):
https://your-api-url(no/v1) - Codex integrations (OpenAI Responses protocol):
https://your-api-url/v1(with/v1)
The most common mistake is appending /v1 to a Claude URL, or forgetting it on a Codex URL.
Q38: Five things to confirm before any external integration
Any one of these out of sync can cause 403 / 401 / model-not-available errors:
- Group: which model's group the key belongs to
- Protocol: client speaks
Anthropic MessagesorOpenAI Responses - Base URL: Claude no
/v1, Codex yes/v1 - Headers: external integrations need the right
User-Agent - Model: some groups allow empty, others require an exact model ID
Q39: JetBrains IDE shows the plugin but returns 401
Check, in order:
- The IDE is reading stale local auth state (OAuth leftover)
- The key has been moved to the correct group
- The plugin overrode the local
settings.json
Recommended: configure Claude Code or Codex via CC Switch on the host first, confirm the CLI works, then let the IDE reuse that environment.
Q40: JetBrains / Trae works in CLI but fails in IDE
The key isn't the problem — IDE-side config is. Check whether the IDE is reading the wrong config file, dropping headers, or applying extra restrictions on local proxies / certificates.
Q41: Trae still can't connect after updating Base URL
Check:
- The Claude / Codex URLs aren't swapped (Claude no
/v1, Codex with/v1) - The plugin actually supports custom URLs
- The current plugin version supports external integrations at all
- If Claude works but Codex doesn't, you're probably missing
/v1on Codex or still using a Claude model name
Codex CLI Specifics
Q42: What's the Base URL format for Codex CLI?
Codex's Base URL requires /v1, unlike Claude Code:
Claude Code: https://your-api-url (no /v1)
Codex CLI : https://your-api-url/v1 (with /v1)Q43: Where are Codex CLI's config files? How do I configure manually?
Two files:
~/.codex/config.toml(Windows:C:\Users\<user>\.codex\config.toml)~/.codex/auth.json(Windows:C:\Users\<user>\.codex\auth.json)
config.toml reference:
model_provider = "custom"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
[model_providers.custom]
name = "custom"
base_url = "https://your-api-url/v1"
wire_api = "responses"
requires_openai_auth = true
model_context_window = 1000000
model_auto_compact_token_limit = 900000auth.json reference:
{
"OPENAI_API_KEY": "sk-***"
}Q44: How do I enable 1M context for Codex CLI?
In ~/.codex/config.toml make sure you have:
model_context_window = 1000000
model_auto_compact_token_limit = 900000model_context_window: usable context window set to 1,000,000model_auto_compact_token_limit: triggers compaction before hitting the limit
Q45: Codex CLI reasoning is too slow
Change model_reasoning_effort in config.toml from high to medium or low:
low: fast — simple code gen or quick Q&Amedium: balanced — day-to-day work (recommended)high: slow — complex algorithms or architecture design
Q46: Codex CLI says the API key is invalid
- Double-check the key in
~/.codex/auth.json - Confirm the proxy has remaining balance and the token isn't expired
Q47: Can Claude Code and Codex CLI conflict if installed together?
No. Their config files are isolated. CC Switch can manage both:
- Claude Code →
~/.claude/settings.json - Codex CLI →
~/.codex/config.toml+~/.codex/auth.json
OpenClaw Specifics
Q48: What is OpenClaw? How do I install it?
OpenClaw Gateway is an AI proxy gateway with built-in support for messaging channels like Feishu, Telegram, and Discord. Default Web UI: http://127.0.0.1:18789/.
# Install
npm install -g openclaw@latest
# First-run wizard
openclaw onboard --install-daemonIn the wizard: choose QuickStart → skip provider selection → select all models → keep default model → choose a notification channel (Feishu / TG / Discord) → configure Skills and Hooks (session-memory recommended).
Q49: OpenClaw provider config returns 403 block
OpenClaw is an external client — different providers need their own group and User-Agent.
Claude provider:
API endpoint: https://your-api-url
Protocol: Anthropic Messages
Headers:
"Authorization": "Bearer sk-***"
"User-Agent": "claude-cli/2.0.76 (external, cli)"Codex provider:
API endpoint: https://your-api-url/v1
Protocol: OpenAI Responses
Headers:
"Authorization": "Bearer sk-***"
"User-Agent": "codex_cli_rs/0.77.0 (Windows 10.0.26100; x86_64) WindowsTerminal"Chinese model provider:
Headers:
"Authorization": "Bearer sk-***"
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0"Key reminder: don't reuse Claude's UA on a Codex provider, and don't omit the browser-style UA on Chinese model providers.
Q50: Can one OpenClaw instance host multiple models?
Yes. A single OpenClaw can host Claude, Codex, and Chinese models simultaneously. Each provider needs the matching group and User-Agent — no mixing.
Q51: Configuring the Feishu channel
- Go to open.feishu.cn, create a custom-built enterprise app, and enable the bot capability
- In permissions, filter by
imand check all related scopes - Create a version and publish it. Save the App ID and App Secret
- Enter App ID and App Secret in the OpenClaw wizard, or via CLI:
openclaw config set -- channels.feishu.appId "your-app-id"
openclaw config set -- channels.feishu.appSecret "your-app-secret"- In the Feishu open platform, add a "Receive Message" event
- Create a new version and publish again — otherwise the subscription doesn't activate
- From the Feishu workspace, message the bot to get a pairing code, then run:
openclaw pairing approve feishu your-pairing-codeNote: OpenClaw must be running while configuring Feishu subscriptions — start it via openclaw gateway if needed.
Q52: OpenClaw group-message response policy
- Reply to all messages: fine for private test groups
- Only on @mention: best for multi-person work groups (recommended)
- No group replies: DMs only
CC Switch and Config Management
Q53: CC Switch changes don't take effect
- Restart Claude Code (close the whole terminal window, not just open a new tab)
- Check whether system env vars are overriding CC Switch's config (env vars take precedence)
- If needed, delete
~/.claudeand reconfigure
Q54: How do I switch back to the official channel and re-OAuth?
- Back up
~/.claudeand~/.claude.json - Clear old sessions, history, and auth leftovers
- In CC Switch, switch to the official channel; or wipe the proxy config and run
claudeto log in
Advanced Configuration and Efficiency
Q55: Reducing token usage and unnecessary traffic
Merge into ~/.claude/settings.json:
{
"ENABLE_TOOL_SEARCH": true,
"skipWebFetchPreflight": true,
"env": {
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}ENABLE_TOOL_SEARCH: cuts down tokens leaked by tool-call searchesCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: disables telemetry and update checksskipWebFetchPreflight: skip the WebFetch preflight (essential on domestic networks)
Q56: Using CLAUDE.md to boost efficiency
Create a CLAUDE.md at the project root with the tech stack, directory layout, and dev conventions. Claude Code auto-loads it as context on startup:
# Project name
## Tech stack
- Frontend: React + TypeScript
- Backend: Node.js + Express
## Layout
- src/ — source code
- tests/ — test files
## Conventions
- ESLint + Prettier
- Commits follow Conventional CommitsAccurate project context cuts token consumption noticeably and keeps Claude Code from re-asking about the structure.
Q57: Recommended MCP extensions
context7: live tech documentation lookupdeepwiki: knowledge base accessplaywright: browser automationexa: intelligent search
Q58: Using hooks
Place hook scripts under ~/.claude/hooks/ (global) or .claude/hooks/ (per project):
before-tool-use: fires before a tool callafter-tool-use: fires after a tool calluser-prompt-submit: fires when the user submits a prompt
Q59: Custom commands
Create .md files under ~/.claude/commands/ or .claude/commands/. For example, ~/.claude/commands/review.md gets triggered by typing /review in a conversation.
Q60: Common commands
/model: switch model (opus / sonnet / haiku)/model sonnet[1m]: switch to the 1M long-context variant/cost: current session's token usage/compact: compress context to free up space/resume: resume a previous conversation/clear: wipe the current conversation/help: list all commands/exitor pressCtrl + Ctwice: quit
Q61: General triage checklist
- Confirm group, Base URL, and User-Agent align (see Q38)
- Check for stale env vars (
Win + R→sysdm.cpl, or inspect~/.zshrc) - Check for OAuth tokens in
~/.claude.json(clear withclaude auth logout) - Rewrite the config via CC Switch, close and reopen the terminal, retry
- For external integrations, run through the 5-item checklist (group, protocol, Base URL, headers, model)