{"record":{"id":"daa91fb8c568c45e","repo":"ipfs/kubo","slug":"unrecognized-key-type-s-daa91f","errorCode":null,"errorMessage":"unrecognized key type: %s","messagePattern":"unrecognized key type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/coreapi/key.go","lineNumber":113,"sourceCode":"\t\tpk = pub\n\tcase \"ed25519\":\n\t\tpriv, pub, err := crypto.GenerateEd25519Key(rand.Reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsk = priv\n\t\tpk = pub\n\tcase \"secp256k1\":\n\t\tpriv, pub, err := crypto.GenerateSecp256k1Key(rand.Reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsk = priv\n\t\tpk = pub\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unrecognized key type: %s\", options.Algorithm)\n\t}\n\n\terr = api.repo.Keystore().Put(name, sk)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newKey(name, pid)\n}\n\n// List returns a list keys stored in keystore.\nfunc (api *KeyAPI) List(ctx context.Context) ([]coreiface.Key, error) {\n\t_, span := tracing.Span(ctx, \"CoreAPI.KeyAPI\", \"List\")","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreapi/key.go#L95-L131","documentation":"Generate switches on the requested key algorithm (e.g. RSA, Ed25519, ECDSA, secp256k1) to call the matching crypto key generator. An algorithm value outside the recognized set falls into the default branch and returns this error.","triggerScenarios":"KeyAPI.Generate with caopts.KeyGenerateOptions whose Algorithm is misspelled, empty, or unsupported by this crypto build (e.g. `ipfs key gen k --type=rsa4096` or `--type=ed` instead of ed25519).","commonSituations":"Typo in the --type flag in scripts; keys generated on a binary built without a particular crypto backend; copying flag values from docs of a different tool/version.","solutions":["Use one of the supported --type values: RSA, Ed25519, ECDSA, secp256k1 (exact casing/values per `ipfs key gen --help`).","Fix the algorithm string in the script/config that produced the wrong value.","Check the kubo/crypto implementation in use if you need an algorithm you believe should be supported."],"exampleFix":"// before\nipfs key gen mykey --type=ed\n// after\nipfs key gen mykey --type=ed25519","handlingStrategy":"validation","validationCode":"var valid = map[string]bool{\"RSA\": true, \"Ed25519\": true, \"ECDSA\": true, \"secp256k1\": true}\nif !valid[options.Algorithm] {\n    return fmt.Errorf(\"unsupported key type %q; use RSA, Ed25519, ECDSA, or secp256k1\", options.Algorithm)\n}","typeGuard":"func knownKeyType(t string) bool {\n    switch t {\n    case \"RSA\", \"Ed25519\", \"ECDSA\", \"secp256k1\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"sk, err := genKey(options.Algorithm, options.Size)\nif err != nil {\n    return fmt.Errorf(\"key type %q not supported by this build: %w\", options.Algorithm, err)\n}","preventionTips":["Only pass algorithms accepted by `ipfs key gen --help`","Centralize algorithm constants instead of raw strings in scripts","Check kubo docs for the algorithm set of your kubo version"],"tags":["keystore","keys","crypto","validation"],"backgroundTag":"unsupported-algorithm","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"}