ipfs/kubo · error

required Datastore.Spec entry missing from config file

Error message

required Datastore.Spec entry missing from config file

What it means

Fired by FSRepo.openDatastore when the config has neither old-style Datastore.Type/Path nor a Datastore.Spec — i.e. the required modern datastore spec entry is absent from the config file. This guard catches corrupt or hand-trimmed configs; the repo cannot open without a datastore specification.

Source

Thrown at repo/fsrepo/fsrepo.go:492

func (r *FSRepo) openKeystore() error {
	ksp := filepath.Join(r.path, "keystore")
	ks, err := keystore.NewFSKeystore(ksp)
	if err != nil {
		return err
	}

	r.keystore = ks

	return nil
}

// openDatastore returns an error if the config file is not present.
func (r *FSRepo) openDatastore() error {
	if r.config.Datastore.Type != "" || r.config.Datastore.Path != "" {
		return fmt.Errorf("old style datatstore config detected")
	} else if r.config.Datastore.Spec == nil {
		return fmt.Errorf("required Datastore.Spec entry missing from config file")
	}
	if r.config.Datastore.NoSync {
		log.Warn("NoSync is now deprecated in favor of datastore specific settings. If you want to disable fsync on flatfs set 'sync' to false. See https://github.com/ipfs/kubo/blob/master/docs/datastores.md#flatfs.")
	}

	dsc, err := AnyDatastoreConfig(r.config.Datastore.Spec)
	if err != nil {
		return err
	}
	spec := dsc.DiskSpec()

	oldSpec, err := r.readSpec()
	if err != nil {
		return err
	}
	if oldSpec != spec.String() {
		return fmt.Errorf("datastore configuration of '%s' does not match what is on disk '%s'",
			oldSpec, spec.String())

View on GitHub (pinned to 329838acdf)

Solutions

  1. Restore or add the Datastore.Spec section (e.g. from 'ipfs init' in a fresh repo)
  2. Restore $IPFS_PATH/config from a backup if it was truncated
  3. Re-init the repo if no backup exists
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at repo/fsrepo/fsrepo.go:492 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/4ad85412516176ff. Report an issue: GitHub.