dagger/dagger · error

git bundle header line exceeds limit %d

Error message

git bundle header line exceeds limit %d

What it means

A single line of the textual bundle header exceeded the bufio buffer size (maxGitBundleHeaderLine). ReadSlice hit ErrBufferFull, meaning the header has no newline within one line's maximum length — a malformed or adversarial bundle rather than a large pack (only the header is being read at this point).

Source

Thrown at core/git_bundle.go:226

type countingReader struct {
	r io.Reader
	n int64
}

func (r *countingReader) Read(p []byte) (int, error) {
	n, err := r.r.Read(p)
	r.n += int64(n)
	return n, err
}

func parseGitBundleHeader(input io.Reader) (*GitBundle, int64, error) {
	counted := &countingReader{r: input}
	reader := bufio.NewReaderSize(counted, maxGitBundleHeaderLine)
	readLine := func() (string, error) {
		line, err := reader.ReadSlice('\n')
		if errors.Is(err, bufio.ErrBufferFull) {
			return "", fmt.Errorf("git bundle header line exceeds limit %d", maxGitBundleHeaderLine)
		}
		if err != nil {
			if errors.Is(err, io.EOF) {
				return "", fmt.Errorf("git bundle header is truncated")
			}
			return "", fmt.Errorf("read git bundle header: %w", err)
		}
		if counted.n-int64(reader.Buffered()) > maxGitBundleHeaderBytes {
			return "", fmt.Errorf("git bundle header exceeds limit %d", maxGitBundleHeaderBytes)
		}
		return strings.TrimSuffix(string(line), "\n"), nil
	}

	signature, err := readLine()
	if err != nil {
		return nil, 0, err
	}
	bundle := &GitBundle{ObjectFormat: "sha1"}

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Regenerate the bundle with standard `git bundle create` — well-formed header lines are short
  2. If importing untrusted bundles, reject the file at this boundary; the limit exists to bound parsing cost
  3. Verify the file is actually a git bundle and not arbitrary data that happens to pass the size check
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/git_bundle.go:226 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/f51ccbd64501a3d9. Report an issue: GitHub.