{"record":{"id":"e72796e23062b406","repo":"dagger/dagger","slug":"decode-persisted-container-payload-w","errorCode":null,"errorMessage":"decode persisted container payload: %w","messagePattern":"decode persisted container payload: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/container.go","lineNumber":1643,"sourceCode":"\t\t\tOwner:          socket.Owner,\n\t\t})\n\t}\n\n\tenc, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn dagql.PersistedObjectEncoding{}, fmt.Errorf(\"marshal persisted container payload: %w\", err)\n\t}\n\treturn dagql.PersistedObjectEncoding{\n\t\tJSON:          enc,\n\t\tSnapshotLinks: snapshotLinks,\n\t}, nil\n}\n\n//nolint:gocyclo // flat persisted-container dispatch over mount, secret, and socket kinds.\nfunc (*Container) DecodePersistedObject(ctx context.Context, dag *dagql.Server, resultID uint64, call *dagql.ResultCall, payload json.RawMessage) (dagql.Typed, error) {\n\tvar persisted persistedContainerPayload\n\tif err := json.Unmarshal(payload, &persisted); err != nil {\n\t\treturn nil, fmt.Errorf(\"decode persisted container payload: %w\", err)\n\t}\n\tif persisted.Form == \"\" {\n\t\tpersisted.Form = persistedContainerFormReady\n\t}\n\n\tfs := new(LazyAccessor[*Directory, *Container])\n\tvar decodedRootFS decodedContainerDirectoryValue\n\tif len(persisted.FS) > 0 {\n\t\trootfs, err := decodePersistedContainerDirectoryValue(ctx, dag, resultID, \"fs\", persisted.FS)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdecodedRootFS = rootfs\n\t\tif rootfs.Dir != nil {\n\t\t\tfs.setValue(rootfs.Dir)\n\t\t}\n\t}\n","sourceCodeStart":1625,"sourceCodeEnd":1661,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/container.go#L1625-L1661","documentation":"Decoding a persisted container failed at the first step: the stored JSON payload could not be unmarshaled into persistedContainerPayload. The cached container entry is corrupt or was written with a different schema than this version expects. The underlying unmarshal error is wrapped for diagnosis.","triggerScenarios":"DecodePersistedObject receives a payload whose JSON structure doesn't match persistedContainerPayload — wrong field types, truncated JSON, or entries written by an incompatible Dagger version.","commonSituations":"Engine upgrade/downgrade across persisted-object schema changes; shared cache backends with mixed engine versions; corrupted cache storage.","solutions":["Prune the Dagger engine cache and re-run the pipeline","Align the engine version with the one that wrote the cache entries","Inspect the wrapped error for the specific JSON field mismatch","Re-encode the container result instead of reusing the cached entry"],"exampleFix":"// before: reusing stale persisted entry\nctr, err := container.DecodePersistedObject(ctx, dag, resultID, call, payload)\n// after: on decode failure, recompute the container\nctr, err := container.DecodePersistedObject(ctx, dag, resultID, call, payload)\nif err != nil {\n\treturn recomputeContainer(ctx, dag)\n}","handlingStrategy":"try-catch","validationCode":"var probe persistedContainerProbe\nif err := json.Unmarshal(payload, &probe); err != nil || probe.Form == \"\" && len(payload) == 0 {\n\t// treat cache entry as corrupt; skip or prune\n}","typeGuard":null,"tryCatchPattern":"typed, err := container.DecodePersistedObject(ctx, dag, resultID, call, payload)\nif err != nil {\n\t// corrupt/incompatible entry: recompute the container instead of failing\n\treturn recomputeContainer(ctx, dag)\n}","preventionTips":["Prune the engine cache after version upgrades/downgrades","Unify Dagger versions across runners sharing a cache backend","Preserve the wrapped error for diagnosing the exact JSON mismatch"],"tags":["cache","json","serialization","persistence"],"backgroundTag":"cached-payload-schema-mismatch","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"}