abiosoft/colima · error
cannot create file '%s': %w
Error message
cannot create file '%s': %w
What it means
Download had no usable resumable partial (none exists, or resume info was invalid), fell through to os.Create(opts.DestPath) on the .downloading cache file, and the OS refused. The wrapped *fs.PathError names the exact path; typical errnos are EACCES, ENOSPC, EROFS, ENOENT (parent dir deleted after MkdirAll).
Source
Thrown at util/downloader/http.go:122
var file *os.File
var existingSize int64
var err error
if opts.ResumeFromByte > 0 {
file, err = os.OpenFile(opts.DestPath, os.O_WRONLY|os.O_APPEND, 0644)
if err != nil {
// can't resume, start fresh
opts.ResumeFromByte = 0
opts.ExpectedETag = ""
} else {
existingSize = opts.ResumeFromByte
}
}
if file == nil {
file, err = os.Create(opts.DestPath)
if err != nil {
return nil, fmt.Errorf("cannot create file '%s': %w", opts.DestPath, err)
}
}
defer func() { _ = file.Close() }()
// build request
req, err := http.NewRequestWithContext(ctx, http.MethodGet, opts.URL, nil)
if err != nil {
return nil, fmt.Errorf("invalid URL '%s': %w", opts.URL, err)
}
req.Header.Set("User-Agent", h.userAgent)
// add Range header for resume
if existingSize > 0 {
req.Header.Set("Range", fmt.Sprintf("bytes=%d-", existingSize))
// add If-Range with ETag if available for safe resume
if opts.ExpectedETag != "" {
req.Header.Set("If-Range", opts.ExpectedETag)
}View on GitHub (pinned to c3a5f9184d)
Solutions
- Check free space with df -h and free enough for the artifact
- Fix ownership/permissions of the cache directory
- Retry: transient cleanup races resolve on the next attempt
- Exclude the colima cache dir from tmpwatch/cleaner tools
Defensive patterns
Strategy: validation
Validate before calling
dir := filepath.Dir(destPath)
if err := os.MkdirAll(dir, 0o755); err != nil {
return err
}
var st syscall.Statfs_t
if err := syscall.Statfs(dir, &st); err == nil {
free := st.Bavail * uint64(st.Bsize)
if free < requiredBytes {
return fmt.Errorf("insufficient disk space: need %d, free %d", requiredBytes, free)
}
} Prevention
- Check free space before starting downloads that can be gigabytes
- Keep cache-cleanup daemons away from the colima cache dir
- Monitor disk usage in CI/automation so a full disk fails before, not during, a download
When it happens
Trigger: Cache dir deleted between MkdirAll and os.Create (cleanup race); directory not writable; disk full; DestPath already exists as a directory.
Common situations: Disk full when pulling large images; cache-cleaner tools racing the download; root-owned caches directory from earlier sudo runs.
Related errors
- error preparing cache dir: %w
- error during prune: %w
- error creating temp file: %w
- error writing temp file: %w
- failed to create bundle directory: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/731b587ac6c50ffc.
Report an issue: GitHub.