ipfs/kubo · error

failed to sync: %w

Error message

failed to sync: %w

What it means

'ipfs diag ds put' wrote the key successfully but the follow-up ds.Sync to force it to storage failed. %w is the underlying sync error, usually a disk I/O problem; the value may or may not be durable. Debugging/testing command only.

Source

Thrown at core/commands/diag.go:255

	Arguments: []cmds.Argument{
		cmds.StringArg("key", true, false, "Datastore key (e.g., /test/mykey)"),
		cmds.StringArg("value", true, false, "Value to store (as a string)"),
	},
	NoRemote: true,
	PreRun:   DaemonNotRunning,
	Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
		ds, closer, err := openDiagDatastore(env)
		if err != nil {
			return err
		}
		defer closer()

		key := datastore.NewKey(req.Arguments[0])
		if err := ds.Put(req.Context, key, []byte(req.Arguments[1])); err != nil {
			return fmt.Errorf("failed to put key: %w", err)
		}
		if err := ds.Sync(req.Context, key); err != nil {
			return fmt.Errorf("failed to sync: %w", err)
		}
		return nil
	},
}

type diagDatastoreCountResult struct {
	Prefix string `json:"prefix"`
	Count  int64  `json:"count"`
}

var diagDatastoreCountCmd = &cmds.Command{
	Status: cmds.Experimental,
	Helptext: cmds.HelpText{
		Tagline: "Count entries matching a datastore prefix.",
		ShortDescription: `
Counts the number of datastore entries whose keys start with the given prefix.

The daemon must not be running when using this command.

View on GitHub (pinned to 329838acdf)

Solutions

  1. Check disk health and free space on the repo volume
  2. Retry the command; sync failures are often transient
  3. Verify persistence afterwards with 'ipfs diag ds get'
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at core/commands/diag.go:255 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/00cfff87e1d074e3. Report an issue: GitHub.