dagger/dagger · error
git bundle file is required
Error message
git bundle file is required
What it means
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.
Source
Thrown at core/git_bundle.go:176
file, err := loadPersistedObjectResultByResultID[*File](ctx, dag, persisted.FileResultID, "git bundle file")
if err != nil {
return nil, err
}
return &GitBundle{
File: file,
Version: persisted.Version,
ObjectFormat: persisted.ObjectFormat,
Refs: persisted.Refs,
PrerequisiteSHAs: slices.Clone(persisted.PrerequisiteSHAs),
}, nil
}
// ParseGitBundle lazily reads and validates only a bundle's textual header. It
// deliberately does not walk or import the pack; ValidateGitBundle performs
// that more expensive work.
func ParseGitBundle(ctx context.Context, file dagql.ObjectResult[*File]) (*GitBundle, error) {
if file.Self() == nil {
return nil, fmt.Errorf("git bundle file is required")
}
if err := validateGitBundleFileSize(ctx, file); err != nil {
return nil, err
}
reader, err := file.Self().Open(ctx, file)
if err != nil {
return nil, fmt.Errorf("open git bundle: %w", err)
}
defer reader.Close()
header, _, err := parseGitBundleHeader(reader)
if err != nil {
return nil, err
}
header.File = file
return header, nil
}
View on GitHub (pinned to 82ba2681db)
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
Example fix
// before
bundle := dag.Container().File("maybe.bnd").AsGitBundle()
// after
f := dag.Container().File("bundle.bnd")
if f != nil { bundle := f.AsGitBundle() } Defensive patterns
Strategy: validation
Validate before calling
if file == nil || file.Self() == nil {
return fmt.Errorf("bundle file is nil; produce it first")
} Type guard
func hasSelf(f dagql.ObjectResult[*File]) bool { return f != nil && f.Self() != nil } Try / catch
bundle, err := f.AsGitBundle(ctx)
if err != nil {
if strings.Contains(err.Error(), "required") {
// file handle was empty; recreate upstream
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Passing the output of a conditional/failed container.file(...) call into bundle(); replaying an object whose file dependency didn't materialize.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- encode persisted git bundle: missing bundle file
- git bundle file is empty
- git bundle size %d exceeds limit %d
- malformed secret config at index %d
- cannot set both noNetwork and hostNetwork
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/681dbcb78a813cb1.
Report an issue: GitHub.