[BUG] Search tool silently fails when /tmp is noexec
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code shows that Search tool found 0 files.
What Should Happen?
Search tool should work properly, or print an error that it cannot work. But not claim that there are 0 matching files.
When I set env variable TMPDIR to some other directory, e.g. export TMPDIR="$HOME/tmp", which is not mounted with noexec flag, and then I run claude, the Search tool works perfectly.
Error Messages/Logs
There is no error message. The Search tool just doesn’t find anything.
Steps to Reproduce
- Configure your Linux system with /tmp on tmpfs with noexec flag.
- Run
claudeand ask him to search for something, which should trigger using the Search tool.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.47 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
iTerm2
Additional Information
When debugging with strace, I found out that when a Search tool is used, claude executes (execve) a command /home/user/.local/share/claude/versions/2.1.47 --ripgrep …, which stores some file to /tmp/… and then tries to dlopen it:
error: /tmp/.d8bdb58afabaf7f7-00000000.node: failed to map segment from shared object
code: "ERR_DLOPEN_FAILED"
at <anonymous> (/$bunfs/root/claude:11:1885)
at <anonymous> (/$bunfs/root/claude:11:845)
at uw1 (/$bunfs/root/claude:6169:3854)
at dj1 (/$bunfs/root/claude:11453:15653)
Strace:
[pid 2986631] openat(AT_FDCWD, "/tmp", O_RDONLY|O_CLOEXEC|O_DIRECTORY) = 12
[pid 2986631] openat(12, ".d8bdb58afabaf7f7-00000000.node", O_WRONLY|O_CREAT|O_CLOEXEC, 0644) = 13
[pid 2986631] lseek(13, 0, SEEK_CUR) = 0
[pid 2986631] fallocate(13, 0, 0, 5002216) = 0
[pid 2986631] write(13, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 5002216) = 5002216
[pid 2986631] close(13) = 0
[pid 2986631] openat(AT_FDCWD, "/tmp/.d8bdb58afabaf7f7-00000000.node", O_RDONLY|O_CLOEXEC) = 13
[pid 2986631] read(13, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
[pid 2986631] newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=5002216, ...}, AT_EMPTY_PATH) = 0
[pid 2986631] mmap(NULL, 5015248, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 13, 0) = 0x7fe2306e1000
[pid 2986631] mmap(0x7fe230895000, 2846720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 13, 0x1b3000) = -1 EPERM (Operation not permitted)
[pid 2986631] close(13) = 0
[pid 2986631] unlink("/tmp/.d8bdb58afabaf7f7-00000000.node") = 0This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗