{"record":{"id":"d416499e15831103","repo":"dagger/dagger","slug":"decode-persisted-git-bundle-missing-bundle-file","errorCode":null,"errorMessage":"decode persisted git bundle: missing bundle file","messagePattern":"decode persisted git bundle: missing bundle file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/git_bundle.go","lineNumber":156,"sourceCode":"\t\tFileResultID:     fileID,\n\t\tVersion:          bundle.Version,\n\t\tObjectFormat:     bundle.ObjectFormat,\n\t\tRefs:             bundle.Clone().Refs,\n\t\tPrerequisiteSHAs: slices.Clone(bundle.PrerequisiteSHAs),\n\t})\n\tif err != nil {\n\t\treturn dagql.PersistedObjectEncoding{}, fmt.Errorf(\"marshal persisted git bundle: %w\", err)\n\t}\n\treturn encodePersistedObjectRawJSON(payload), nil\n}\n\nfunc (*GitBundle) DecodePersistedObject(ctx context.Context, dag *dagql.Server, _ uint64, _ *dagql.ResultCall, payload json.RawMessage) (dagql.Typed, error) {\n\tvar persisted persistedGitBundlePayload\n\tif err := json.Unmarshal(payload, &persisted); err != nil {\n\t\treturn nil, fmt.Errorf(\"decode persisted git bundle: %w\", err)\n\t}\n\tif persisted.FileResultID == 0 {\n\t\treturn nil, fmt.Errorf(\"decode persisted git bundle: missing bundle file\")\n\t}\n\tfile, err := loadPersistedObjectResultByResultID[*File](ctx, dag, persisted.FileResultID, \"git bundle file\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GitBundle{\n\t\tFile:             file,\n\t\tVersion:          persisted.Version,\n\t\tObjectFormat:     persisted.ObjectFormat,\n\t\tRefs:             persisted.Refs,\n\t\tPrerequisiteSHAs: slices.Clone(persisted.PrerequisiteSHAs),\n\t}, nil\n}\n\n// ParseGitBundle lazily reads and validates only a bundle's textual header. It\n// deliberately does not walk or import the pack; ValidateGitBundle performs\n// that more expensive work.\nfunc ParseGitBundle(ctx context.Context, file dagql.ObjectResult[*File]) (*GitBundle, error) {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/git_bundle.go#L138-L174","documentation":"Decoding a persisted GitBundle payload failed because the bundle file link is absent. The persisted JSON references a file result, but the corresponding snapshot/file link could not be resolved during decode, so the bundle object cannot be reconstructed. This is a validation guard on the decoded payload's linked file.","triggerScenarios":"Replaying a persisted GitBundle whose cache payload lacks the file result ID — written by a buggy/older encoder, or the payload was hand-edited/truncated after the file field was dropped (omitempty-like behavior or a partial write).","commonSituations":"Cache entries created before the FileResultID field existed; corrupted cache from an interrupted engine run.","solutions":["Prune the engine cache so the bundle is regenerated with a valid file reference","Re-run the operation so EncodePersistedObject writes a fresh payload including the file ID","Verify engine version consistency between cache writers and readers"],"exampleFix":"// before (payload without file)\n{\"version\":2}\n// after\n{\"version\":2,\"fileResultID\":42}","handlingStrategy":"validation","validationCode":"var p persistedGitBundlePayload\nif err := json.Unmarshal(payload, &p); err != nil { return err }\nif p.FileResultID == 0 { return fmt.Errorf(\"payload lacks file result id\") }","typeGuard":"func hasFileResultID(p persistedGitBundlePayload) bool { return p.FileResultID != 0 }","tryCatchPattern":"bundle, err := decode(ctx, payload)\nif err != nil {\n\tif strings.Contains(err.Error(), \"missing bundle file\") {\n\t\treturn rebuildBundle(ctx)\n\t}\n\treturn err\n}","preventionTips":["Never hand-edit or truncate cache payloads","Verify encoder versions match decoder versions","Regenerate bundles rather than trusting foreign cache entries"],"tags":["dagger","git","cache","missing-field"],"backgroundTag":"missing-required-argument","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"}