[BUG] native install fails with EINVAL: invalid argument, copyfile '~/.cache/claude/staging/1.0.123/claude' -> ...

Status Closed — not planned
Maintainer reply None cached
Activity 12 comments · opened Sep 24, 2025 · closed Jan 11, 2026

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?

When installing the native version of claude-code on Ubuntu 22.04.5 I get an error from copyfile.
Apparently, the installation aborts, because when I type the command 'claude' in the terminal, I get "command not found".

I tried to remove all relevant files and directories and try again, but got the same error. Here is the command I used to remove leftovers from a failed install:

rm -rf ~/.cache/claude ~/.local/share/claude ~/.claude*

After manually copying '~/.cache/claude/staging/1.0.123/claude' to '~/bin', I can run 'claude', but 'claude doctor' complains: "Warning: Running native installation but config install method is 'unknown'". Also, this setup will probably fail when claude code tries to update to a new version.

What Should Happen?

Claude Code native should get installed in ~/.local/share/claude and runnable.

Error Messages/Logs

The error message is:
✘ Installation failed

EINVAL: invalid argument, copyfile '/home/user/.cache/claude/staging/1.0.123/claude' -> '/home/user/.local/share/claude/versions/1.0.123.tmp.1129780.1758754356342'

Try running with --force to override checks

Steps to Reproduce

Try to install native Claude Code as suggested in documentation:
curl -fsSL https://claude.ai/install.sh | bash

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.123 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

$ claude doctor

Diagnostics
└ Currently running: native (1.0.123)
└ Path: /home/user/bin/claude
└ Invoked: /home/user/claude-bin/claude
└ Config install method: unknown
└ Auto-updates enabled: default (true)
└ Search: OK (bundled)
Warning: Running native installation but config install method is 'unknown'
Fix: Run claude install to update configuration

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy

View original on GitHub ↗

12 Comments

hsbgit · 11 months ago

Same problem here:

curl -fsSL https://claude.ai/install.sh | bash Setting up Claude Code... ✘ Installation failed EINVAL: invalid argument, copyfile '/home/XXXX/.cache/claude/staging/1.0.127/claude' ->

'/home/XXXX/.local/share/claude/versions/1.0.127.tmp.23967.1758986079378'

I cant find a solution, npm install does also NOT work

neuron303 · 10 months ago

I believe I found the issue.
It seems to be this: https://github.com/oven-sh/bun/issues/13968
So it seems to be related to an encrypted home directory.

running export BUN_CONFIG_DISABLE_COPY_FILE_RANGE=true lets the installation succeed

PS: I found the issue using strace. The last call was copy_file_range but the parameters seemed to be right. Glad to have found the issue reported with bun.

aoand · 10 months ago
I believe I found the issue. So it seems to be related to an encrypted home directory.

Yes, my home directory is encrypted with ecryptfs.

running export BUN_CONFIG_DISABLE_COPY_FILE_RANGE=true lets the installation succeed

Installing with BUN_CONFIG_DISABLE_COPY_FILE_RANGE=true fixed my problem. The latest Claude version installed successfully with no errors or warnings.

Thanks a lot!

hsbgit · 10 months ago

Yes, my home directory is indeed encrypted. And yes, @neuron303 your solutions (export ...) works like a charm! Thank you very much. I reported a link to this issues back to support@mail.anthropic.com as I contacted them

jbenamy · 9 months ago

I am running Linux Mint 22.2 with an encrypted home directory and had the same issue. Running export BUN_CONFIG_DISABLE_COPY_FILE_RANGE=true before running the native installer worked for me.

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

aoand · 8 months ago

The error is still not fixed.
When I try to update Claude Code without BUN_CONFIG_DISABLE_COPY_FILE_RANGE=true I get the same error:

$ claude update
Current version: 2.0.53
Checking for updates...
Error: Failed to install native update
Error: EINVAL: invalid argument, copyfile '/home/aoand/.cache/claude/staging/2.0.65/claude' -> '/home/aoand/.local/share/claude/versions/2.0.65.tmp.543657.1765451323428'
Try running "claude doctor" for diagnostics

As I understand it, the problem is that some filesystems don't support the copy_file_range system call and return EINVAL. Bun uses this syscall during installation (arguably without good reason, since the speed improvement is negligible, if any), which causes the installation to abort. Specifically ecryptfs is known to be problematic: bun: copy_file_range is not supported on eCryptfs.

The fix could be either always use "traditional" copy routine instead of copy_file_range, or retrying with "traditional" copy when copy_file_range returns EINVAL.

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

neuron303 · 7 months ago

wtf?

neuron303 · 7 months ago

The autoclose tag was ok for me. But just closing this without notice is dismissive. We should open a new issue with updated information? What is wrong with you? Finding the issue was already 90% work of this bugfix. I am not your contractor. You don't pay me. I won't report anything with you anymore. It's your product and you are not interested in doing the work. Externalizing costs. If somebody else does the work, good for you.

aoand · 7 months ago

The issue is not fixed, it was updated some 30 days ago (11-Dec-2025). Why it is closed now?

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.