{"record":{"id":"1eed5f5b83bef6db","repo":"dagger/dagger","slug":"short-write-d-d","errorCode":null,"errorMessage":"short write %d/%d","messagePattern":"short write (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/filesync/remotefs.go","lineNumber":170,"sourceCode":"\t\t\t\tfs.filesMu.RLock()\n\t\t\t\trFile, ok := fs.filesByID[pkt.ID]\n\t\t\t\tfs.filesMu.RUnlock()\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fmt.Errorf(\"invalid file request %d\", pkt.ID)\n\t\t\t\t}\n\t\t\t\tif len(pkt.Data) == 0 {\n\t\t\t\t\tif err := rFile.CloseWrite(nil); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to close pipe %d: %w\", pkt.ID, err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tn, err := rFile.write(pkt.Data)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terr = fmt.Errorf(\"failed to write to pipe %d: %w\", pkt.ID, err)\n\t\t\t\t\t\trFile.CloseWrite(err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif n != len(pkt.Data) {\n\t\t\t\t\t\terr := fmt.Errorf(\"short write %d/%d\", n, len(pkt.Data))\n\t\t\t\t\t\trFile.CloseWrite(err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor cp := range walkCh {\n\t\tif err := walkFn(cp.path, &StatInfo{cp.stat}, nil); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tselect {\n\tcase err := <-errCh:\n\t\treturn fmt.Errorf(\"receive failed: %w\", err)\n\tdefault:\n\t\treturn nil","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/filesync/remotefs.go#L152-L188","documentation":"Returned when rFile.write reports it wrote fewer bytes than the PACKET_DATA chunk contained (n != len(pkt.Data)). The io.PipeWriter normally returns either full writes or an error, so a short write indicates an unexpected pipe writer behavior; the file is closed with the error and Walk aborts.","triggerScenarios":"rFile.write (io.PipeWriter.Write) returns n < len(pkt.Data) with a nil error while streaming a file's data chunk during Walk.","commonSituations":"Practically rare; would indicate an anomalous pipe implementation or memory/contract violation in the streaming path rather than user misconfiguration.","solutions":["Retry the sync operation; this aborts the whole Walk so nothing is partially committed","Check the dagger version for known streaming bugs and upgrade CLI/engine together","Report with reproduction details if it recurs, including file size and include/exclude patterns"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"short write\") {\n    // whole Walk aborted; retry from scratch\n    err = fs.Walk(ctx, \".\", walkFn)\n}","preventionTips":["Retry the full sync — partial state is discarded by design","Keep dagger versions current to rule out known pipe bugs","Report reproducible cases with file sizes involved"],"tags":["filesync","io","short-write"],"backgroundTag":"short-write","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}