{"record":{"id":"5cbaf0dd8194e2e7","repo":"ipfs/kubo","slug":"cannot-create-key-with-name-self","errorCode":null,"errorMessage":"cannot create key with name 'self'","messagePattern":"cannot create key with name 'self'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/keystore.go","lineNumber":115,"sourceCode":"\t\tke.OptionIPNSBase,\n\t},\n\tArguments: []cmds.Argument{\n\t\tcmds.StringArg(\"name\", true, false, \"name of key to create\"),\n\t},\n\tRun: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tapi, err := cmdenv.GetApi(env, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttyp, f := req.Options[keyStoreTypeOptionName].(string)\n\t\tif !f {\n\t\t\treturn errors.New(\"please specify a key type with --type\")\n\t\t}\n\n\t\tname := req.Arguments[0]\n\t\tif name == \"self\" {\n\t\t\treturn errors.New(\"cannot create key with name 'self'\")\n\t\t}\n\n\t\topts := []options.KeyGenerateOption{options.Key.Type(typ)}\n\n\t\tsize, sizefound := req.Options[keyStoreSizeOptionName].(int)\n\t\tif sizefound {\n\t\t\topts = append(opts, options.Key.Size(size))\n\t\t}\n\t\tkeyEnc, err := ke.KeyEncoderFromString(req.Options[ke.OptionIPNSBase.Name()].(string))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tkey, err := api.Key().Generate(req.Context, name, opts...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/keystore.go#L97-L133","documentation":"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.","triggerScenarios":"Thrown at core/commands/keystore.go:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}