benbjohnson/litestream · error
create temp database path: %w
Error message
create temp database path: %w
What it means
Restore could not create the temporary file (<output>.tmp) that results are compacted into before the atomic rename. Permission denial in the output directory or a name collision with a leftover .tmp file.
Source
Thrown at replica.go:734
}
// Create parent directory if it doesn't exist.
var dirInfo os.FileInfo
if db := r.DB(); db != nil {
dirInfo = db.dirInfo
}
if err := internal.MkdirAll(filepath.Dir(opt.OutputPath), dirInfo); err != nil {
return fmt.Errorf("create parent directory: %w", err)
}
// Output to temp file & atomically rename.
tmpOutputPath := opt.OutputPath + ".tmp"
r.Logger().Debug("compacting into database", "path", tmpOutputPath, "n", len(rdrs))
defer func() { _ = os.Remove(tmpOutputPath) }()
f, err := os.Create(tmpOutputPath)
if err != nil {
return fmt.Errorf("create temp database path: %w", err)
}
defer func() { _ = f.Close() }()
pr, pw := io.Pipe()
go func() {
c, err := ltx.NewCompactor(pw, rdrs)
if err != nil {
pw.CloseWithError(fmt.Errorf("new ltx compactor: %w", err))
return
}
c.HeaderFlags = ltx.HeaderFlagNoChecksum
_ = pw.CloseWithError(c.Compact(ctx))
}()
dec := ltx.NewDecoder(pr)
if err := dec.DecodeDatabaseTo(f); err != nil {
return fmt.Errorf("decode database: %w", err)View on GitHub (pinned to 4ed7a308f6)
Solutions
- Check write permissions on the output directory
- Remove a stale <output>.tmp left by a crashed restore
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at replica.go:734 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/749a152f6c99410d.
Report an issue: GitHub.