{"record":{"id":"ce0d7aa05c7e1758","repo":"dagger/dagger","slug":"decode-persisted-container-withoutdefaultargs-lazy","errorCode":null,"errorMessage":"decode persisted container withoutDefaultArgs lazy payload: %w","messagePattern":"decode persisted container withoutDefaultArgs lazy payload: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/container.go","lineNumber":4284,"sourceCode":"\tcase \"withDefaultArgs\":\n\t\tvar persisted persistedContainerWithDefaultArgsLazy\n\t\tif err := json.Unmarshal(payload, &persisted); err != nil {\n\t\t\treturn fmt.Errorf(\"decode persisted container withDefaultArgs lazy payload: %w\", err)\n\t\t}\n\t\tparent, err := loadPersistedObjectResultByResultID[*Container](ctx, dag, persisted.ParentResultID, \"container withDefaultArgs parent\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcontainer.Lazy = &ContainerWithDefaultArgsLazy{\n\t\t\tLazyState: NewLazyState(),\n\t\t\tParent:    parent,\n\t\t\tArgs:      persisted.Args,\n\t\t}\n\t\treturn nil\n\tcase \"withoutDefaultArgs\":\n\t\tvar persisted persistedContainerWithoutDefaultArgsLazy\n\t\tif err := json.Unmarshal(payload, &persisted); err != nil {\n\t\t\treturn fmt.Errorf(\"decode persisted container withoutDefaultArgs lazy payload: %w\", err)\n\t\t}\n\t\tparent, err := loadPersistedObjectResultByResultID[*Container](ctx, dag, persisted.ParentResultID, \"container withoutDefaultArgs parent\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcontainer.Lazy = &ContainerWithoutDefaultArgsLazy{\n\t\t\tLazyState: NewLazyState(),\n\t\t\tParent:    parent,\n\t\t}\n\t\treturn nil\n\tcase \"withUser\":\n\t\tvar persisted persistedContainerWithUserLazy\n\t\tif err := json.Unmarshal(payload, &persisted); err != nil {\n\t\t\treturn fmt.Errorf(\"decode persisted container withUser lazy payload: %w\", err)\n\t\t}\n\t\tparent, err := loadPersistedObjectResultByResultID[*Container](ctx, dag, persisted.ParentResultID, \"container withUser parent\")\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":4266,"sourceCodeEnd":4302,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/container.go#L4266-L4302","documentation":"This error wraps a json.Unmarshal failure while decoding the persisted lazy payload for a Container's withoutDefaultArgs operation during lazy replay. The payload for case \"withoutDefaultArgs\" must decode into persistedContainerWithoutDefaultArgsLazy; if it does not, the error is returned with the underlying JSON reason wrapped via %w. It indicates persisted-state corruption or a schema mismatch, not a container issue.","triggerScenarios":"Calling Container.WithoutDefaultArgs within a persisted lazy chain whose stored payload is malformed JSON or was produced by an incompatible schema version.","commonSituations":"Cache from an older Dagger version replayed by newer code; partially written or corrupted cache entries; manual migration/edits of persisted results; schema field changes without cache busting.","solutions":["Clear the Dagger engine cache to force regeneration of the payload","Ensure engine and CLI versions match","Verify the payload JSON has required fields (parentResultID) with correct types","Re-run the pipeline with a fresh session so the chain is re-encoded"],"exampleFix":"// before: stale cache replay\ncontainer.WithoutDefaultArgs() // decode persisted container withoutDefaultArgs lazy payload: ...\n// after: purge cache and re-run\ncontainer.WithoutDefaultArgs() // fresh payload decodes successfully","handlingStrategy":"try-catch","validationCode":"var probe map[string]any\nif err := json.Unmarshal(payload, &probe); err != nil {\n\treturn fmt.Errorf(\"persisted withoutDefaultArgs payload is not valid JSON: %w\", err)\n}\nif _, ok := probe[\"parentResultID\"]; !ok {\n\treturn errors.New(\"persisted withoutDefaultArgs payload missing parentResultID\")\n}","typeGuard":"func isValidWithoutDefaultArgsLazyPayload(payload []byte) bool {\n\tvar p persistedContainerWithoutDefaultArgsLazy\n\treturn json.Unmarshal(payload, &p) == nil && p.ParentResultID != \"\"\n}","tryCatchPattern":"if err := decodeWithoutDefaultArgsLazy(ctx, dag, payload, container); err != nil {\n\tif isUnmarshalError(err) {\n\t\tlogger.Warn(\"corrupt persisted withoutDefaultArgs payload; regenerating\")\n\t\treturn rebuildContainerChainFromSource(ctx, container)\n\t}\n\treturn err\n}","preventionTips":["Match CLI/engine versions to avoid schema drift in persisted payloads","Purge stale cache entries after Dagger upgrades","Detect truncated payloads (unexpected EOF) and discard them at load time","Store a schema version alongside persisted results and reject mismatches"],"tags":["go","json","serialization","cache","dagger"],"backgroundTag":"json-unmarshal-failed","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"}