ipfs/kubo · error

key with name '%s' doesn't exist

Error message

key with name '%s' doesn't exist

What it means

Lookup failure in `ipfs key export`: the keystore on disk has no key file under the requested name. Note the implementation wraps any ks.Get error into this message, so it most often means the name is wrong or the key was never created, but a permissions or filesystem error reading the keystore can also surface as it.

Source

Thrown at core/commands/keystore.go:222

		ver, err := migrations.RepoVersion(cfgRoot)
		if err != nil {
			return err
		}
		if ver != fsrepo.RepoVersion {
			return fmt.Errorf("key export expects repo version (%d) but found (%d)", fsrepo.RepoVersion, ver)
		}

		// Export is read-only: safe to read it without acquiring repo lock
		// (this makes export work when ipfs daemon is already running)
		ksp := filepath.Join(cfgRoot, "keystore")
		ks, err := keystore.NewFSKeystore(ksp)
		if err != nil {
			return err
		}

		sk, err := ks.Get(name)
		if err != nil {
			return fmt.Errorf("key with name '%s' doesn't exist", name)
		}

		exportFormat, _ := req.Options[keyFormatOptionName].(string)
		var formattedKey []byte
		switch exportFormat {
		case keyFormatPemCleartextOption:
			stdKey, err := crypto.PrivKeyToStdKey(sk)
			if err != nil {
				return fmt.Errorf("converting libp2p private key to std Go key: %w", err)
			}
			// For some reason the ed25519.PrivateKey does not use pointer
			// receivers, so we need to convert it for MarshalPKCS8PrivateKey.
			// (We should probably change this upstream in PrivKeyToStdKey).
			if ed25519KeyPointer, ok := stdKey.(*ed25519.PrivateKey); ok {
				stdKey = *ed25519KeyPointer
			}
			if secpKey, ok := stdKey.(*crypto.Secp256k1PrivateKey); ok {
				// crypto/x509 does not support the secp256k1 curve

View on GitHub (pinned to 329838acdf)

Solutions

  1. Run ipfs key list to see existing key names and correct the typo
  2. Create the key first with ipfs key gen or import it with ipfs key import
  3. Check permissions on the <IPFS_PATH>/keystore directory if the key should exist
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/commands/keystore.go:222 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/1eb519c487ea6420. Report an issue: GitHub.