Try free

Last updated 13 October 2026

Find Claude Code logs after a crash

The sudden disappearance of a running session

Your terminal window is suddenly empty and the standard shell prompt is waiting for your next input. You were just watching Claude Code plan a complex migration across three different directories in your repository. Now the agent is gone and you have no idea if it finished the last file or if it left your codebase in a broken state. This type of sudden exit is frustrating because it often leaves no error code or stack trace on the screen. You are left wondering if the binary itself crashed or if your internet connection dropped at the exact moment a tool was running.

You need a reliable way to find the trace of what happened so you can fix the issue and get back to your development flow. Without a clear log, you might spend hours guessing whether the problem was a malformed JSON file, a network timeout, or a memory limit on your machine. Finding where the tool records its activity is the first step in diagnosing why the CLI stopped responding. The silence of a crash is the hardest part to debug, but the information you need is stored on your local disk if you know which hidden directories to check.

Locate the global configuration and data directory

Most persistent data for Claude Code lives in a hidden folder within your home directory. This folder is named dot-claude and it acts as the central hub for the tool on your machine. It stores your global configuration files and the history of your interactions with the agent. When the CLI starts, it checks this location to verify your identity and load your user-level preferences. If a crash occurs during the initial startup phase, the cause is often a corrupted or inaccessible file in this specific location.

You should navigate to this directory using your terminal or a file explorer that shows hidden items. Look for the file named settings dot json in the home dot-claude folder. While this file primarily holds your preferences, its presence and health are vital for the tool to function. If you find other files in this directory that have been modified at the exact time of the crash, those files likely contain the state of the session or the last messages exchanged. Checking the timestamps on these files will help you narrow down exactly when the process terminated.

Run the built-in diagnostic tool

You should immediately run the claude doctor command in your terminal. This is a built-in diagnostic tool designed to find environment problems that lead to crashes or unexpected exits. It will test your local installation and check if the necessary permissions are granted to the binary. It also verifies your connection to the Anthropic servers. If you are working behind a corporate proxy or a firewall, the doctor command will often highlight where the connection is failing, which can cause the CLI to hang or crash without a specific error message.

The output of claude doctor provides a clear list of checks. If you see any red marks or failure messages, you have found your primary suspect. This command saves you from searching through raw files by summarizing the state of your installation in plain text. It checks if your authentication is still valid and if the tool can write to the necessary directories. If the doctor command says everything is fine, the crash was likely caused by a specific file in your project or a rare edge case in the code the agent was trying to process.

Check for local project configuration errors

Claude Code also looks for a folder named dot-claude in the root of your project repository. Inside this folder, you might find a settings dot json file or a settings dot local dot json file. These files tell the agent how to behave in this specific repo. If there is a syntax error in one of these JSON files, such as a missing comma or an unclosed brace, the agent might crash the moment it tries to parse them. You should use a standard text editor to check if the formatting is correct in these files.

If the agent crashes only in one specific project but works in others, the cause is almost certainly inside this project-level folder. You can try renaming the dot-claude folder temporarily to see if the agent starts working again with default values. This will tell you if a local setting or a custom instruction is triggering the failure. Sometimes an override in settings dot local dot json conflicts with the global settings, leading to an unhandled exception that closes the terminal session before you can see what went wrong.

Investigate sessions with the resume command

Use the resume command to investigate the state of your previous work without digging through raw data. By typing claude hyphen hyphen resume, or using the short version claude hyphen r, you get a list of all recent sessions. This list includes the time of each session and the project folder it belongs to. If you see your crashed session in this list, try to select it. If it opens successfully, the crash was likely a temporary interruption rather than a total failure of the session data.

Once you are back inside a resumed session, you can use the slash status command to see what the agent thinks is happening. This command provides a summary of the current task and the last few steps the agent took. You can also use the slash cost and slash usage commands to see if the session was interrupted by a limit on your spending or token usage. This interactive approach to finding information is often more productive than reading raw files because it shows you the logical state of the agent just before it stopped.

Review project instructions and permissions

Project instructions can sometimes lead to behavior that looks like a crash. The CLAUDE dot md file in your root directory or any subdirectory contains the rules the agent must follow. If these instructions are contradictory or extremely long, they might cause the agent to hit context limits or behave erratically. While this usually does not cause the CLI itself to crash, it can lead to the agent stopping its work prematurely. You should review these files to ensure they are clear and do not contain complex commands that might trigger an infinite loop.

Permissions often cause the agent to stop unexpectedly if it tries to perform an action it is not allowed to do. If the agent tries to use the edit tool or the write tool on a file it cannot access, it might encounter an error it cannot recover from. Check the permissions section in your settings dot json file. You can see if you have set specific tools to be denied by default. If you use the shift plus tab shortcut inside an active session, you can cycle through permission modes like acceptEdits or plan mode to see if changing the mode prevents the crash from recurring.

Monitor multiple sessions for errors

Managing many sessions at once increases the risk of losing track of a crash. When you run several instances of Claude Code in different terminal tabs, you might miss the moment one of them fails. You might return to a tab minutes later only to find it back at the shell prompt. This is a common problem for developers who use the agent for complex multi-tasking across different parts of a large system.

The adhdTerminal app provides a better way to monitor these sessions simultaneously. It displays each Claude Code instance as a tile on a wall, showing you the status of each one at a glance. Each tile has a color and a name, and it explicitly shows whether a session is working, waiting for you, or idle. If a session crashes, the tile state will change clearly. You can see the last few lines of the conversation on the tile, which helps you identify the exact prompt or tool call that caused the failure without hunting through hidden tabs.

Inspect terminal buffers and shell history

Look at your terminal shell history to see exactly what happened before the crash. You can use the control plus r shortcut in your terminal to search for the last commands you ran. Sometimes the error is not in Claude Code but in a tool the agent tried to run in the background. If the agent used the bash tool to run a command that consumed too much memory, your operating system might have killed the process. This looks like a crash of the agent, but it is actually an external termination by the system.

Reviewing the raw output in your terminal buffer often reveals a line of text that the agent did not have time to process. If you see a large block of text or a stack trace after the agent exits, copy it into a new file immediately. This text is your best source of information for a bug report. You can use the slash bug command inside a new session to report the issue, providing the text you captured from your terminal buffer as evidence. This helps the developers understand what caused the CLI to fail on your specific machine.

Recover from a crash and clean the state

If you find that the tool continues to crash even after checking settings and permissions, you may need to clear the session state. The slash clear command inside a session will start over in the same folder, which can resolve issues caused by a corrupted context window. If you cannot even start the session to run a slash command, you can use the claude hyphen p command to run a single prompt that does not use the interactive interface. This can sometimes bypass UI-related crashes and let you perform a final write or read before resetting.

If you suspect the issue is related to the context window being too full, you can use the slash compact command once you get back into a session. This summarizes the conversation so far and frees up space in the context window. Keeping your sessions lean and your CLAUDE dot md files concise is the best way to prevent the tool from becoming unstable. If all else fails, running claude update will ensure you have the latest fixes for known bugs that might be causing the crashes you are experiencing.

Questions people ask

Where are the actual log files kept?

Claude Code stores its data and session history in the dot-claude folder in your home directory. You will find files like settings dot json here, and any temporary files created during a session are also located in this path. There is no single file named log, but checking the most recently modified files in this directory will show you the session data.

How can I see what the agent was doing right before a crash?

Run the command claude hyphen hyphen resume to see a list of your latest sessions. Selecting the session that crashed will often bring back the last successful state. You can then use the slash status command to see the current task summary or scroll up in your terminal buffer to see the last tool output.

What should I do if the agent crashes every time it reads a specific file?

Check the permissions for that file and your settings dot json configuration for the read tool. If the file is very large or contains unusual characters, it might be causing a memory issue. You can try to use the slash compact command to reduce the current context or use a more specific glob pattern to read only the parts of the file you need.

Read next

More on when it goes wrong·All posts