ipfs/kubo · error

query error: %w

Error message

query error: %w

What it means

'ipfs diag ds count': an individual result from the ongoing datastore query iteration returned an Error. %w is that per-entry error; counting stops and the partial count is discarded. Usually a storage read failure mid-iteration. Debugging/testing command only.

Source

Thrown at core/commands/diag.go:306

		defer closer()

		prefix := req.Arguments[0]

		q := query.Query{
			Prefix:   prefix,
			KeysOnly: true,
		}

		results, err := ds.Query(req.Context, q)
		if err != nil {
			return fmt.Errorf("failed to query datastore: %w", err)
		}
		defer results.Close()

		var count int64
		for result := range results.Next() {
			if result.Error != nil {
				return fmt.Errorf("query error: %w", result.Error)
			}
			count++
		}

		return cmds.EmitOnce(res, &diagDatastoreCountResult{
			Prefix: prefix,
			Count:  count,
		})
	},
	Type: diagDatastoreCountResult{},
	Encoders: cmds.EncoderMap{
		cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, result *diagDatastoreCountResult) error {
			_, err := fmt.Fprintf(w, "%d\n", result.Count)
			return err
		}),
	},
}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Re-run the count; transient read errors may not recur
  2. Investigate the wrapped error for datastore corruption
  3. Check disk health on the repo volume
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at core/commands/diag.go:306 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/ce5c6cdfff09a15e. Report an issue: GitHub.