ipfs/kubo · error
cannot create key with name 'self'
Error message
cannot create key with name 'self'
What it means
Reserved-name guard in `ipfs key gen`: the requested key name is literally 'self', which the keystore reserves for the node's own identity key. Creating a user key with that name would shadow the identity peer, so the command refuses before touching the keystore.
Source
Thrown at core/commands/keystore.go:115
ke.OptionIPNSBase,
},
Arguments: []cmds.Argument{
cmds.StringArg("name", true, false, "name of key to create"),
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
api, err := cmdenv.GetApi(env, req)
if err != nil {
return err
}
typ, f := req.Options[keyStoreTypeOptionName].(string)
if !f {
return errors.New("please specify a key type with --type")
}
name := req.Arguments[0]
if name == "self" {
return errors.New("cannot create key with name 'self'")
}
opts := []options.KeyGenerateOption{options.Key.Type(typ)}
size, sizefound := req.Options[keyStoreSizeOptionName].(int)
if sizefound {
opts = append(opts, options.Key.Size(size))
}
keyEnc, err := ke.KeyEncoderFromString(req.Options[ke.OptionIPNSBase.Name()].(string))
if err != nil {
return err
}
key, err := api.Key().Generate(req.Context, name, opts...)
if err != nil {
return err
}
View on GitHub (pinned to 329838acdf)
Solutions
- Pick a different name for the key, e.g. ipfs key gen mykey --type=ed25519
- Use ipfs id if you intended to inspect the node's own 'self' identity
- Reference the self identity directly with the name 'self' in commands like ipfs name publish
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/commands/keystore.go:115 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/5cbaf0dd8194e2e7.
Report an issue: GitHub.