Product case study · November 9, 2026
Capture one Claude Code print-mode request with tools disabled
Run one fictional print-mode request, record its exit status and timestamps, and inspect the debug log locally.

Keep one timestamped reproduction and a short reviewed report; a debug file alone does not prove the cause or the fix.
Use this Bash lab to capture a single print-mode request with built-in and MCP tools disabled. If the failure happens in an interactive session, use the interactive debug report guide.
Sources checked November 9, 2026. This is a documentation-backed reader exercise. We checked the local capture wrapper with a simulated command, including a nonzero exit; we did not make an authenticated Claude request or reproduce a live service failure. The expected observations below are acceptance checks, not reported Claude results.
You need Bash on Linux or macOS, Python 3, and an installed Claude Code CLI for the live step. Authentication and ordinary account usage apply to a model request. For installation and a first project, use the Claude Code lesson.
Give the investigation a narrow question
Write down the last visible symptom before changing anything: the action you attempted, the error text and the time. “The request failed” is an observation. “The account is broken” is a hypothesis until you have supporting evidence.
Use Anthropic’s troubleshooting entry point to select the appropriate investigation: installation and login, configuration, request errors, or performance. If the executable cannot start, a model request is the wrong first test. Resolve that earlier failure before this exercise.
For a baseline, use the fictional prompt below in an empty folder. If it works, you have only shown that this small request works under those conditions. A repository-specific failure still needs its own minimal reproduction.
Prepare a private capture directory
Run these commands in one Bash terminal and keep it open:
lab_root=$(mktemp -d /tmp/claude-debug-lab.XXXXXX)
mkdir -m 700 "$lab_root/project" "$lab_root/evidence"
cd "$lab_root/project"
printf 'Keep this path: %s\n' "$lab_root"
The directory is outside your repository so the evidence does not accidentally enter a commit. It is an empty project, not a new Claude account or an isolation boundary: existing user and managed configuration may still apply.
Record the installed interface:
claude --version > "$lab_root/evidence/cli-version.txt"
claude --help > "$lab_root/evidence/cli-help.txt"
Read both files locally. Confirm that help lists --debug-file, --print, --tools and --disallowedTools before proceeding. If a flag is missing, record the version mismatch and stop; do not silently substitute another command.
The CLI reference documents --debug-file as enabling debug logging and choosing its destination. Print mode returns a response and exits. An empty tools list disables built-in tools; the separate MCP deny rule below excludes MCP tools. These options do not promise that inherited startup customizations will never run.
Capture one small attempt
Use a subshell so the restrictive file-creation mask applies only to the capture:
(
umask 077
date -u '+%Y-%m-%dT%H:%M:%SZ' > "$lab_root/evidence/started-at.txt"
if claude --debug-file "$lab_root/evidence/debug.log" \
--tools "" --disallowedTools "mcp__*" --print 'Reply with exactly: practice capture complete' \
> "$lab_root/evidence/stdout.txt" \
2> "$lab_root/evidence/stderr.txt"; then
capture_status=0
else
capture_status=$?
fi
printf '%s\n' "$capture_status" > "$lab_root/evidence/exit-status.txt"
date -u '+%Y-%m-%dT%H:%M:%SZ' > "$lab_root/evidence/finished-at.txt"
)
This command makes a real request if your installation and account permit it. It does not deliberately trigger an outage or an authentication error. If it stalls, interrupt the attempt with Ctrl+C and record that intervention; missing end files mean the capture did not finish normally. Do not turn the exercise into an automatic retry loop.
Inspect the file inventory without printing the logs:
python3 - "$lab_root/evidence" <<'PY'
from pathlib import Path
import sys
root = Path(sys.argv[1])
for name in ("started-at.txt", "finished-at.txt", "exit-status.txt",
"stdout.txt", "stderr.txt", "debug.log"):
path = root / name
if path.is_file():
print(f"{name}: {path.stat().st_size} bytes")
else:
print(f"{name}: MISSING")
PY
A missing or empty debug file is a capture problem, not evidence that nothing went wrong. Confirm the path and supported flag first. Keep stdout, stderr and debug output separate: a response, a terminal diagnostic and an internal event can tell different parts of the story.
Read for the event that matches your symptom
Open the evidence files in a local editor. Start with the recorded exit status and visible output, then read the debug events around the attempted action. Do not assume a stable log schema or build an automated parser from one sample.
Use this worksheet in your own notes:
| Observation | What it establishes | What remains open |
|---|---|---|
| The process returned zero | The invocation reported success | Whether the expected answer appeared |
| The answer contains the requested phrase | This small response met the prompt | Whether the original project issue is fixed |
| A diagnostic appears near the failure | A candidate event for investigation | Whether it caused the visible symptom |
| The baseline succeeds but the project fails | The two attempts differ | Which difference matters |
| Capture files are missing | Evidence is incomplete | Whether the request started or completed |
If the evidence points to configuration, consult Debug your configuration. It documents claude doctor for terminal diagnostics, /status for active settings sources and /mcp for server status. Pick the check matching the symptom and record what it actually reports. Avoid changing several settings at once: you would lose the comparison that makes the next attempt informative.
For request errors, look up the exact message in the official error reference. Preserve the observed code and wording in your private notes. Do not infer a billing problem, rate limit or provider outage from a generic failure alone.
Create a report you can review before sharing
Write a new report manually rather than copying the whole log. Use this authored template:
CLI version:
Operating system:
Approximate attempt time and timezone:
Minimal reproduction using fictional input:
Expected behavior:
Observed behavior:
Process exit status, or interrupted/unknown:
Small reviewed diagnostic excerpt, if needed:
Hypothesis and evidence for it:
One next check:
Live fix verified: yes / no / not tested
Inspect any excerpt for credentials, personal paths, private endpoints, source code and conversation content. A keyword search is not proof of complete redaction. If you cannot make a useful excerpt safe to share, describe the symptom without attaching it and ask the recipient what specific evidence they need.
Anthropic’s data usage documentation distinguishes ordinary usage from feedback submissions and transcript sharing. Read the applicable sharing flow before sending anything. This exercise ends with a local report; it does not require /feedback, a public issue or a log upload.
After a proposed fix, capture a second attempt in a new folder using the same minimal reproduction. Record the single intentional change. Call the fix verified only if the original failure condition was exercised and the expected result was observed. Otherwise, label it a hypothesis or a baseline pass.
To stop explicit debug capture, leave --debug-file out of later invocations. Keep private evidence only as long as you need it, following your organization’s retention rules. Removing this lab’s files would not remove session data Claude stores elsewhere.
Official sources
Checked November 9, 2026:
- CLI reference: debug-file destination, print mode and tool selection.
- Troubleshooting: symptom-based investigation routes.
- Debug your configuration: diagnostic commands and active settings sources.
- Error reference: matching an observed request error to its documented explanation.
- Data usage: feedback and transcript-sharing considerations.
Put this to work
Use a debug capture to narrow a failure without treating every warning as its cause.
Try
Record a small fictional request with an explicit debug-file path.
Prove it worked
Check the capture exists and record whether the original symptom actually recurred.
Keep in view
- Capture one attempt in a private folder outside your repository.
- Separate the process exit, the observed symptom and a proposed cause.
- Write a minimal report from reviewed observations instead of uploading raw logs.