Error -146059294 in `Base.cp` when trying to copy large files

Dear Julia community,

I am having same problem that Base.cp fails for large file:
I am using the latest version of Julia.

Thanks,
Joseph

IOError: sendfile: Unknown system error -146059294 (Unknown system error -146059294)

Stacktrace:
 [1] uv_error
   @ .\libuv.jl:106 [inlined]
 [2] sendfile(dst::Base.Filesystem.File, src::Base.Filesystem.File, src_offset::Int64, bytes::Int64)
   @ Base.Filesystem .\filesystem.jl:224
 [3] sendfile(src::String, dst::String)
   @ Base.Filesystem .\file.jl:1131
 [4] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
   @ Base.Filesystem .\file.jl:386
 [5] top-level scope
   @ d:\JOE\MAIN\MODELS\WFLOW\WflowDataJoe\WflowRaster.jl\src\jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_Y133sZmlsZQ==.jl:5

Maybe you could work around it using run? e.g. something like

function mycp(src::AbstractString, dst::AbstractString; force::Bool=false)
    cmd = Sys.iswindows() ? `cmd /c copy` : `cp`
    force_option = Sys.iswindows() ? (force ? `/y` : `/-y`) : (force ? `-f` : `-n`)
    cmd = `$cmd $force_option`
    run(`$cmd $src $dst`)
end
3 Likes

This looks to be unrelated to the other issue; I’ve moved this to a new topic. Are you sure that you’re on the latest version of Julia? That error code is surprisingly unique; it doesn’t appear to have ever been written down anywhere on GitHub or even on the web at large (until today), either as a signed or unsigned value.

Does the error persist in a fresh Julia session?

Hi @stevengj ,
You are ever so kind for solving my issue.
Your solution works amazingly and solved the problem of moving very large NetCDF files.
With Kindness,
Joseph A.P. Pollacco

Dear @mbauman ,

A great thanks for your reply. I am using Version 1.11.7 (2025-09-08).
I am trying to copy very large NetCDF files 80,108,221 KB

The command I am using in Jupyter notebook:

      Base.Filesystem.cp(Path_Copy, Path_Paste, force=true)

Thanks for your kindness,
Joseph

Sounds similar to IOError from cp with large file on Windows · Issue #30723 · JuliaLang/julia · GitHub, although the exact error messages reported there vary a bit

Yeah, it seems like the error number itself is getting corrupted in some way?

1 Like

hi matt @mbauman I have been running into this error consistently as well.

ERROR: IOError: sendfile: Unknown system error -184335295 (Unknown system error -184335295)
Stacktrace:
  [1] uv_error
    @ ./libuv.jl:106 [inlined]
  [2] sendfile(dst::Base.Filesystem.File, src::Base.Filesystem.File, src_offset::Int64, bytes::Int64)
    @ Base.Filesystem ./filesystem.jl:224
  [3] sendfile(src::String, dst::String)
    @ Base.Filesystem ./file.jl:1131
  [4] cptree(src::String, dst::String; force::Bool, follow_symlinks::Bool)
    @ Base.Filesystem ./file.jl:353
  [5] cptree
    @ ./file.jl:340 [inlined]
  [6] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
    @ Base.Filesystem ./file.jl:384

julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

this is about a 4GB zip file. the run version of @stevengj works for me here.

If you’re able, it’d be great if you could try use uv_fs_copyfile for cp by stevengj · Pull Request #59662 · JuliaLang/julia · GitHub. You may be able to just install it from Juliaup directly: juliaup add pr59662.