golang/go · error

reading inputs: %v

Error message

reading inputs: %v

What it means

Returned by CovDataReader.Visit when pods.CollectPods fails while scanning the input coverage directories (r.indirs). CollectPods walks the -coverpkg output directories looking for coverage meta-data and counter pods; any filesystem-level failure is wrapped with 'reading inputs' and propagated, aborting the visit.

Source

Thrown at src/cmd/internal/cov/readcovdata.go:134

	// Invoked for each function  the package being visited.
	VisitFunc(pkgIdx uint32, fnIdx uint32, fd *coverage.FuncDesc)

	// Invoked when all counter + meta-data file processing is complete.
	Finish()
}

type CovDataReaderFlags uint32

const (
	CovDataReaderNoFlags CovDataReaderFlags = 0
	PanicOnError                            = 1 << iota
	PanicOnWarning
)

func (r *CovDataReader) Visit() error {
	podlist, err := pods.CollectPods(r.indirs, false)
	if err != nil {
		return fmt.Errorf("reading inputs: %v", err)
	}
	if len(podlist) == 0 {
		r.warn("no applicable files found in input directories")
	}
	for _, p := range podlist {
		if err := r.visitPod(p); err != nil {
			return err
		}
	}
	r.vis.Finish()
	return nil
}

func (r *CovDataReader) verb(vlevel int, s string, a ...any) {
	if r.verbosityLevel >= vlevel {
		fmt.Fprintf(os.Stderr, s, a...)
		fmt.Fprintf(os.Stderr, "\n")
	}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Confirm each -indirs path exists and is a readable directory: `ls -la <dir>`.
  2. Ensure the user has read+execute permission on the coverage tree.
  3. Wait for `go test -cover` runs to finish writing before processing.
  4. Point -indirs at the actual coverage output root (typically the dir containing meta-data/counter files).

Example fix

// before
go tool covdata textfmt -i=/missing/path -o out.txt

// after
go tool covdata textfmt -i=$(go env GOCOVERDIR) -o out.txt
Defensive patterns

Strategy: validation

Validate before calling

for _, d := range indirs {
    info, err := os.Stat(d)
    if err != nil { return fmt.Errorf("indir %s: %w", d, err) }
    if !info.IsDir() { return fmt.Errorf("indir %s is not a directory", d) }
}

Prevention

When it happens

Trigger: Running `go tool covdata` (or any caller of CovDataReader.Visit) with -indirs pointing at a path that errors during the pod walk — unreadable directory, permission denied, broken symlink, or a path that is a file rather than a directory.

Common situations: Passing a non-existent or permission-restricted -indirs value, pointing at a file instead of the coverage output directory, racing with `go test -cover` still writing counters, or moving the coverage tree mid-read.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/924c7cc7999f8ba0. Report an issue: GitHub.