{"record":{"id":"6b4f305d78791790","repo":"BoundaryML/baml","slug":"failed-syncing-destination-s-w","errorCode":null,"errorMessage":"failed syncing destination %s: %w","messagePattern":"failed syncing destination (.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/baml_go/lib_common.go","lineNumber":660,"sourceCode":"\tdestination, err := os.Create(dst)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed create destination %s: %w\", dst, err)\n\t}\n\tdefer func() {\n\t\tcerr := destination.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = fmt.Errorf(\"failed close destination %s: %w\", dst, cerr)\n\t\t}\n\t}()\n\n\t_, err = io.Copy(destination, source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed copying from %s to %s: %w\", src, dst, err)\n\t}\n\n\terr = destination.Sync()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed syncing destination %s: %w\", dst, err)\n\t}\n\n\tlogger.Debug(\"File copied successfully\", \"source\", src, \"destination\", dst)\n\treturn nil\n}\n\nfunc isSupportedPlatform() bool {\n\tosOk := runtime.GOOS == \"darwin\" || runtime.GOOS == \"linux\" || runtime.GOOS == \"windows\"\n\tarchOk := runtime.GOARCH == \"amd64\" || runtime.GOARCH == \"arm64\"\n\treturn osOk && archOk\n}\n\nfunc initSlog() {\n\tlogLevel := slog.LevelInfo\n\n\tenvLevel := os.Getenv(\"BAML_LOG\")\n\tswitch strings.ToUpper(envLevel) {\n\tcase \"TRACE\":","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/baml_go/lib_common.go#L642-L678","documentation":"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.","triggerScenarios":"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.","commonSituations":"Nearly-full disks on CI runners; exotic filesystems (some overlay/FUSE/network mounts) where fsync fails; failing hardware.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// fsync only works on regular local filesystems; check mount\nif isNetworkMount(filepath.Dir(dst)) {\n    return fmt.Errorf(\"do not place library cache on network filesystem\")\n}","typeGuard":null,"tryCatchPattern":"if err := baml.DownloadLibrary(dst); err != nil {\n    if strings.Contains(err.Error(), \"failed syncing\") {\n        // verify disk health and space; relocate cache to local fs and retry\n        os.Remove(dst)\n        return relocateAndRetry(dst)\n    }\n    return err\n}","preventionTips":["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"],"tags":["go","file-io","fsync","native-library-download"],"backgroundTag":"file-write-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}