dagger/dagger · error
decode persisted file chown lazy: %w
Error message
decode persisted file chown lazy: %w
What it means
Wraps a json.Unmarshal failure decoding a persisted 'chown' lazy payload (persistedFileChownLazy) into a FileChownLazy. The payload stores a parent File and the owner (chown) target; invalid or schema-drifted JSON blocks rehydration. Same persisted-lazy-state corruption/compatibility family as errors 660-663.
Source
Thrown at core/file.go:486
Search: persisted.Search,
Replacement: persisted.Replacement,
FirstFrom: persisted.FirstFrom,
All: persisted.All,
}, nil
case persistedFileLazyKindWithTimestamps:
var persisted persistedFileWithTimestampsLazy
if err := json.Unmarshal(payload, &persisted); err != nil {
return nil, fmt.Errorf("decode persisted file withTimestamps lazy: %w", err)
}
parent, err := loadPersistedObjectResultByResultID[*File](ctx, dag, persisted.ParentResultID, "file withTimestamps parent")
if err != nil {
return nil, err
}
return &FileWithTimestampsLazy{LazyState: NewLazyState(), Parent: parent, Timestamp: persisted.Timestamp}, nil
case persistedFileLazyKindChown:
var persisted persistedFileChownLazy
if err := json.Unmarshal(payload, &persisted); err != nil {
return nil, fmt.Errorf("decode persisted file chown lazy: %w", err)
}
parent, err := loadPersistedObjectResultByResultID[*File](ctx, dag, persisted.ParentResultID, "file chown parent")
if err != nil {
return nil, err
}
return &FileChownLazy{LazyState: NewLazyState(), Parent: parent, Owner: persisted.Owner}, nil
default:
return nil, fmt.Errorf("decode persisted file lazy payload: unsupported lazy kind %q", lazyKind)
}
}
func (lazy *FileBlobLazy) Evaluate(ctx context.Context, file *File) error {
return lazy.LazyState.Evaluate(ctx, "File.blob", func(ctx context.Context) error {
if dir, _ := filepath.Split(lazy.Filename); dir != "" {
return fmt.Errorf("file name %q must not contain a directory", lazy.Filename)
}
if err := ValidateFileName(lazy.Filename); err != nil {
return errView on GitHub (pinned to 82ba2681db)
Solutions
- Regenerate state by clearing the bad persisted entry and re-running
- Match engine versions across all environments touching the state
- Verify persistedFileChownLazy JSON tags match the encoder
- Examine the wrapped error to identify the failing field
Defensive patterns
Strategy: try-catch
Try / catch
lazy, err := decodePersistedFileLazy(ctx, dag, payload, kind)
if err != nil {
if strings.Contains(err.Error(), "decode persisted file chown lazy") {
return reapplyChown(ctx, dag)
}
return err
} Prevention
- Keep Owner field serialization stable across versions
- Avoid sharing persisted state between engine builds
- Prune caches when upgrading
- Log and alert on decode failures as corruption signals
When it happens
Trigger: Decoding a persistedFileLazyKindChown payload: malformed JSON, Owner field type mismatch (e.g. owner encoded as string vs structured object), or payload written by an incompatible engine version.
Common situations: Engine version skew; corrupted engine state; Owner serialization format changed between versions; shared CI cache carrying foreign payloads.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- decode persisted container withoutAnnotation lazy payload: %
- decode persisted container file lazy: %w
- decode persisted file withName lazy: %w
- decode persisted file withReplaced lazy: %w
- decode persisted file withTimestamps lazy: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/25704cd29237f5f1.
Report an issue: GitHub.