BoundaryML/baml · error
failed copying from to
Error message
failed copying from %s to %s: %w
What it means
copyFile (called by downloadBamlLibrary) wraps io.Copy failures with this message, indicating the byte transfer from the source (downloaded artifact) to the destination file failed partway. The %w preserves the underlying read/write error.
Solutions
- Free disk space on the destination volume and retry
- Ensure only one process is performing the download/copy at a time (avoid concurrent builds sharing the cache)
- Check for antivirus/quarantine tools interfering with the destination path
- Delete the partial destination file and re-trigger downloadBamlLibrary
Defensive patterns
Strategy: retry
Validate before calling
if fi, err := os.Stat(src); err != nil || fi.Size() == 0 {
return fmt.Errorf("source artifact missing or empty")
} Try / catch
for attempt := 0; attempt < 3; attempt++ {
err := baml.DownloadLibrary(dst)
if err == nil || !strings.Contains(err.Error(), "failed copying") {
return err
}
time.Sleep(backoff(attempt))
} Prevention
- Ensure adequate free disk space before downloads
- Serialize downloads across concurrent processes/CI jobs (file lock)
- Exclude the cache directory from antivirus real-time scanning
When it happens
Trigger: io.Copy returns non-nil: source read fails (source file removed/truncated mid-copy) or destination write fails (disk full, I/O error) while copying the BAML native library artifact.
Common situations: Disk filling up during first-run native library download; concurrent processes writing the same temp file; antivirus or container storage issues interrupting writes.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- failed close destination
- failed syncing destination
- decodeCheckedValue: valueChecked is nil
- decodeLiteralValue: valueLiteral is nil
- decodeRawObjectImpl is not set. Please call…
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/87a6462f9c2c8a59.
Report an issue: GitHub.
Appendix: source
Thrown at engine/language_client_go/baml_go/lib_common.go:655
if err != nil {
return fmt.Errorf("failed open source %s: %w", src, err)
}
defer source.Close()
destination, err := os.Create(dst)
if err != nil {
return fmt.Errorf("failed create destination %s: %w", dst, err)
}
defer func() {
cerr := destination.Close()
if err == nil && cerr != nil {
err = fmt.Errorf("failed close destination %s: %w", dst, cerr)
}
}()
_, err = io.Copy(destination, source)
if err != nil {
return fmt.Errorf("failed copying from %s to %s: %w", src, dst, err)
}
err = destination.Sync()
if err != nil {
return fmt.Errorf("failed syncing destination %s: %w", dst, err)
}
logger.Debug("File copied successfully", "source", src, "destination", dst)
return nil
}
func isSupportedPlatform() bool {
osOk := runtime.GOOS == "darwin" || runtime.GOOS == "linux" || runtime.GOOS == "windows"
archOk := runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64"
return osOk && archOk
}
func initSlog() {View on GitHub (pinned to bd85ce9dee)