dagger/dagger · error
short write %d/%d
Error message
short write %d/%d
What it means
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.
Source
Thrown at engine/filesync/remotefs.go:170
fs.filesMu.RLock()
rFile, ok := fs.filesByID[pkt.ID]
fs.filesMu.RUnlock()
if !ok {
return fmt.Errorf("invalid file request %d", pkt.ID)
}
if len(pkt.Data) == 0 {
if err := rFile.CloseWrite(nil); err != nil {
return fmt.Errorf("failed to close pipe %d: %w", pkt.ID, err)
}
} else {
n, err := rFile.write(pkt.Data)
if err != nil {
err = fmt.Errorf("failed to write to pipe %d: %w", pkt.ID, err)
rFile.CloseWrite(err)
return err
}
if n != len(pkt.Data) {
err := fmt.Errorf("short write %d/%d", n, len(pkt.Data))
rFile.CloseWrite(err)
return err
}
}
}
}
}()
for cp := range walkCh {
if err := walkFn(cp.path, &StatInfo{cp.stat}, nil); err != nil {
return err
}
}
select {
case err := <-errCh:
return fmt.Errorf("receive failed: %w", err)
default:
return nilView on GitHub (pinned to 82ba2681db)
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
Defensive patterns
Strategy: retry
Try / catch
if err != nil && strings.Contains(err.Error(), "short write") {
// whole Walk aborted; retry from scratch
err = fs.Walk(ctx, ".", walkFn)
} Prevention
- 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
When it happens
Trigger: rFile.write (io.PipeWriter.Write) returns n < len(pkt.Data) with a nil error while streaming a file's data chunk during Walk.
Common situations: Practically rare; would indicate an anomalous pipe implementation or memory/contract violation in the streaming path rather than user misconfiguration.
Related errors
- failed to receive file bytes message: %w
- failed to close file: %w
- failed to close pipe %d: %w
- failed to write to pipe %d: %w
- count lines of added %s: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/1eed5f5b83bef6db.
Report an issue: GitHub.