{"record":{"id":"d398d6db4637e3e9","repo":"ipfs/kubo","slug":"no-key-by-the-given-name-or-peerid-was-found","errorCode":null,"errorMessage":"no key by the given name or PeerID was found","messagePattern":"no key by the given name or PeerID was found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/coreapi/name.go","lineNumber":249,"sourceCode":"\n\t// Then, look in the keystore.\n\tfor _, key := range keys {\n\t\tprivKey, err := kstore.Get(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpid, err := peer.IDFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif targetPid == pid {\n\t\t\treturn privKey, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"no key by the given name or PeerID was found\")\n}\n","sourceCodeStart":231,"sourceCodeEnd":251,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreapi/name.go#L231-L251","documentation":"keylookup (called by Publish) searched the node's self key and then every keystore entry, comparing derived peer IDs against the requested target PeerID/Key. When nothing matches, it returns this error: the requested publishing identity does not exist on this node.","triggerScenarios":"Publishing with a key selector (name or PeerID) that matches no keystore entry and not self, e.g. `ipfs name publish --key=<peerID> ...` for a peer ID this node does not own.","commonSituations":"Publishing on the wrong node (key exists on another daemon); typo in key name; expecting a remote key to be usable locally; peer ID of an imported-but-since-deleted key.","solutions":["Run `ipfs key list` (or KeyAPI.List) and use an exact existing key name or this node's own peer ID.","Import the key on this node first: `ipfs key import <name> <keyfile>`.","Verify you are talking to the node that owns the key (check `ipfs id`)."],"exampleFix":"// before\napi.Name().Publish(ctx, p, options.Key(\"wrongPeerID\"))\n// after\nkeys, _ := api.Key().List(ctx)\n// pick an existing key name from keys, e.g. \"self\" or a generated key\napi.Name().Publish(ctx, p, options.Key(\"publish-key\"))","handlingStrategy":"validation","validationCode":"keys, err := api.Key().List(ctx)\nif err != nil {\n    return err\n}\nif !slices.ContainsFunc(keys, func(k coreiface.Key) bool { return k.Name() == keyName }) {\n    return fmt.Errorf(\"key %q not present on this node\", keyName)\n}","typeGuard":null,"tryCatchPattern":"_, err := api.Name().Publish(ctx, p, opts.Key(keyName))\nif err != nil && strings.Contains(err.Error(), \"no key by the given name\") {\n    return fmt.Errorf(\"import or generate %q on this node before publishing\", keyName)\n}","preventionTips":["List keys on the target node before publishing.","Import keys with `ipfs key import` when moving between nodes.","Confirm node identity with `ipfs id` when publishing by PeerID."],"tags":["ipns","publish","keystore","not-found"],"backgroundTag":"key-not-found","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}