{"record":{"id":"681dbcb78a813cb1","repo":"dagger/dagger","slug":"git-bundle-file-is-required","errorCode":null,"errorMessage":"git bundle file is required","messagePattern":"git bundle file is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/git_bundle.go","lineNumber":176,"sourceCode":"\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) {\n\tif file.Self() == nil {\n\t\treturn nil, fmt.Errorf(\"git bundle file is required\")\n\t}\n\tif err := validateGitBundleFileSize(ctx, file); err != nil {\n\t\treturn nil, err\n\t}\n\treader, err := file.Self().Open(ctx, file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open git bundle: %w\", err)\n\t}\n\tdefer reader.Close()\n\n\theader, _, err := parseGitBundleHeader(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader.File = file\n\treturn header, nil\n}\n","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/git_bundle.go#L158-L194","documentation":"ParseGitBundle requires a non-nil dagql.ObjectResult[*File]; file.Self() == nil means no actual File instance is behind the result. The function refuses to parse a bundle when its file input is missing.","triggerScenarios":"Calling ParseGitBundle (directly or via asGitBundle/bundle GraphQL resolvers) with a File result whose underlying object is nil — e.g. an ID resolved to nothing, or a File built from a failed/partial operation.","commonSituations":"Passing the output of a conditional/failed container.file(...) call into bundle(); replaying an object whose file dependency didn't materialize.","solutions":["Verify the File was produced successfully before passing it to bundle()/ParseGitBundle","Check that the File ID passed from GraphQL resolves to a real file","Re-create the file (e.g. export bundle again) instead of reusing a stale handle"],"exampleFix":"// before\nbundle := dag.Container().File(\"maybe.bnd\").AsGitBundle()\n// after\nf := dag.Container().File(\"bundle.bnd\")\nif f != nil { bundle := f.AsGitBundle() }","handlingStrategy":"validation","validationCode":"if file == nil || file.Self() == nil {\n\treturn fmt.Errorf(\"bundle file is nil; produce it first\")\n}","typeGuard":"func hasSelf(f dagql.ObjectResult[*File]) bool { return f != nil && f.Self() != nil }","tryCatchPattern":"bundle, err := f.AsGitBundle(ctx)\nif err != nil {\n\tif strings.Contains(err.Error(), \"required\") {\n\t\t// file handle was empty; recreate upstream\n\t}\n\treturn err\n}","preventionTips":["Check the upstream operation producing the File succeeded before bundling","Don't pass conditionally-created files without a nil check","Recreate file handles from the current session rather than old ones"],"tags":["dagger","git","null-reference","validation"],"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"}