BoundaryML/baml · error
failed syncing destination
Error message
failed syncing destination %s: %w
What it means
copyFile calls destination.Sync() after copying to flush data to stable storage; if Sync fails the error is wrapped as "failed syncing destination". This guarantees the downloaded native library is durably on disk before use.
Solutions
- Check and free disk space, then retry the download
- Test whether the target filesystem supports fsync (try writing a file manually); relocate the cache to a standard local filesystem
- Check dmesg/system logs for underlying I/O errors on the disk
- Clear the destination file and re-run
Defensive patterns
Strategy: validation
Validate before calling
// fsync only works on regular local filesystems; check mount
if isNetworkMount(filepath.Dir(dst)) {
return fmt.Errorf("do not place library cache on network filesystem")
} Try / catch
if err := baml.DownloadLibrary(dst); err != nil {
if strings.Contains(err.Error(), "failed syncing") {
// verify disk health and space; relocate cache to local fs and retry
os.Remove(dst)
return relocateAndRetry(dst)
}
return err
} Prevention
- Store native library caches on standard local filesystems (ext4/apfs), not FUSE/NFS
- Watch for early disk-full warnings in CI
- Check dmesg for I/O errors if sync failures repeat
When it happens
Trigger: destination.Sync() returns non-nil after a successful io.Copy — typically fsync failing due to disk full, I/O errors, or unsupported-on-filesystem operations.
Common situations: Nearly-full disks on CI runners; exotic filesystems (some overlay/FUSE/network mounts) where fsync fails; failing hardware.
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 copying from to
- 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/6b4f305d78791790.
Report an issue: GitHub.
Appendix: source
Thrown at engine/language_client_go/baml_go/lib_common.go:660
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() {
logLevel := slog.LevelInfo
envLevel := os.Getenv("BAML_LOG")
switch strings.ToUpper(envLevel) {
case "TRACE":View on GitHub (pinned to bd85ce9dee)