OmniscioGuidesTemp directory refused
Claude Code: temp directory refused or could not be created
Last checked against Anthropic's documentation on November 21, 2026. By the Omniscio team. Updated .
What is the exact message?
Anthropic lists four forms. The first is a full volume:
Claude Code's temporary directory /tmp/claude-501 could not be created: the volume holding /tmp is full (ENOSPC). Free space on that volume, or set CLAUDE_CODE_TMPDIR to a directory on another one, then try again.The other three refuse an entry that already exists at that path:
Temp directory /tmp/claude-501 is not a directory (may be an attacker-planted symlink). Refusing to use it. Set CLAUDE_CODE_TMPDIR to a directory you control, or ask an administrator to remove it.Temp directory /tmp/claude-501 is owned by uid 502, expected 501. Refusing to use it — another user may have pre-created it. Set CLAUDE_CODE_TMPDIR to a directory you control, or ask an administrator to remove it.Temp directory /tmp/claude-501 is not readable (its mode may have been altered, or a path component denies search). Refusing to use it — restore its permissions (chmod 0700) or remove it. Set CLAUDE_CODE_TMPDIR to a directory you control, or ask an administrator to remove it.Before v2.1.309, a full volume, or one whose quota was used up, printed only the operating system's error text instead. Anthropic's example is ENOSPC: no space left on device, mkdir '/tmp/claude-501', and it says the same steps apply.
What does it mean?
On macOS and Linux, Claude Code creates a private temp directory at startup. It is named claude-<uid> and sits under the system temp directory, or under the CLAUDE_CODE_TMPDIR override when that is set.
When the directory cannot be created, or an entry already at that path fails the safety checks, Claude Code prints the failure to stderr and exits with code 1 rather than start the session.
Each form names the check it failed. A full volume is a disk-space problem.
A symlink where a directory should be, an entry owned by a different user, and a directory that is not readable are refusals: Claude Code stops rather than use an entry that failed its safety checks. uid is the number your account has, and id -u prints yours, so "expected 501" means the folder belongs to a different account.
The symlink form's parenthetical says what the check guards against; the message reports what the path is, not that an attack happened. The path in every form is an example: yours and its uid numbers will differ, so match on the wording.
How do I fix it?
- For
is full (ENOSPC), free disk space on the volume the message names. If it says your disk quota on that volume is used up (EDQUOT), delete your own files there that you no longer need. - Before you remove anything, look at what is at that path.
ls -ld /tmp/claude-501shows whether it is a directory, a link, and which account owns it. Use the path your message names. - For a
Refusing to use itform, remove the named entry itself, not what a link points to, then start Claude Code again. For theowned by uidform, only an administrator or that user can remove it. - For
is not readable, runchmod 0700on the named directory, or remove it and start again.0700means only your own account can read, write and enter it. - Or move the temp directory. Set
CLAUDE_CODE_TMPDIRto a directory you control and start Claude Code again, leaving the refused path alone. For one run:mkdir -p ~/claude-tmp && CLAUDE_CODE_TMPDIR=~/claude-tmp claude. - To keep it, add
export CLAUDE_CODE_TMPDIR="$HOME/claude-tmp"to your shell profile and open a new terminal.
How do I know it is fixed?
- Claude Code starts a session instead of exiting with code 1 at startup.
- The directory the message named is either gone from the path or now usable by your account.
- If you set
CLAUDE_CODE_TMPDIR, the new directory exists and is writable by the account running Claude Code.
Where these answers come from
- Anthropic's error reference, Temp directory refused or cannot be created, read November 21, 2026: all four forms, the older ENOSPC wording, the startup behaviour and every fix step.
- Environment variables, for
CLAUDE_CODE_TMPDIRas the override for the temp directory used for internal temp files.
Common questions
Why does Claude Code refuse its temp directory?
On macOS and Linux, Claude Code creates claude-<uid> at startup under the system temp directory or CLAUDE_CODE_TMPDIR. When it cannot be created, or an entry already at that path fails the safety checks, Claude Code prints the failure to stderr and exits with code 1.
What does ENOSPC in the temp directory message mean?
The volume holding the temp directory is full. Free disk space on the volume the message names, or set CLAUDE_CODE_TMPDIR to a directory on another volume. If it says the disk quota is used up (EDQUOT), delete your own files on that volume that you no longer need.
What if the temp directory is owned by another user?
The message says another user may have pre-created it, and Anthropic says only an administrator or that user can remove it. You can also point CLAUDE_CODE_TMPDIR at a directory you control and start Claude Code again, leaving the refused path alone.
Where do I set CLAUDE_CODE_TMPDIR?
Set it in the environment Claude Code starts from, to a directory you control, then start Claude Code again. For one run: mkdir -p ~/claude-tmp && CLAUDE_CODE_TMPDIR=~/claude-tmp claude. To keep it, add export CLAUDE_CODE_TMPDIR="$HOME/claude-tmp" to your shell profile and open a new terminal. The message names it as the fix for every form, and Anthropic's environment variable reference describes it as the override for the temp directory used for internal temp files.