{"record":{"id":"64c076fa1c13dc44","repo":"ipfs/kubo","slug":"please-specify-a-key-type-with-type","errorCode":null,"errorMessage":"please specify a key type with --type","messagePattern":"please specify a key type with --type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/keystore.go","lineNumber":110,"sourceCode":"\t\tTagline: \"Create a new keypair\",\n\t},\n\tOptions: []cmds.Option{\n\t\tcmds.StringOption(keyStoreTypeOptionName, \"t\", \"type of the key to create: rsa, ed25519, secp256k1\").WithDefault(keyStoreAlgorithmDefault),\n\t\tcmds.IntOption(keyStoreSizeOptionName, \"s\", \"size of the key to generate\"),\n\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","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/keystore.go#L92-L128","documentation":"Validation guard in `ipfs key add`/`key gen` option parsing: the --type option value was not a string, meaning the user supplied a key type that could not be read as text (typically an empty or malformed option). It is a plain sentinel error telling the caller to pass --type=rsa|ed25519|secp256k1 explicitly.","triggerScenarios":"Thrown at core/commands/keystore.go:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an explicit key type: ipfs key gen myname --type=ed25519","Choose one of rsa, ed25519, or secp256k1","Omit --type to use the configured default algorithm"],"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"}