{"record":{"id":"8efe66e9d88242c8","repo":"ipfs/kubo","slug":"cannot-get-key-encoder-w","errorCode":null,"errorMessage":"cannot get key encoder: %w","messagePattern":"cannot get key encoder: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/keystore.go","lineNumber":593,"sourceCode":"\t\t\t_, err := w.Write([]byte(ko.Id + \"\\n\"))\n\t\t\treturn err\n\t\t}),\n\t},\n\tType: KeyOutput{},\n}\n\nvar keyListCmd = &cmds.Command{\n\tHelptext: cmds.HelpText{\n\t\tTagline: \"List all local keypairs.\",\n\t},\n\tOptions: []cmds.Option{\n\t\tcmds.BoolOption(\"l\", \"Show extra information about keys.\"),\n\t\tke.OptionIPNSBase,\n\t},\n\tRun: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tkeyEnc, err := ke.KeyEncoderFromString(req.Options[ke.OptionIPNSBase.Name()].(string))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot get key encoder: %w\", err)\n\t\t}\n\n\t\tapi, err := cmdenv.GetApi(env, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tkeys, err := api.Key().List(req.Context)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"listing keys failed: %w\", err)\n\t\t}\n\n\t\tlist := make([]KeyOutput, 0, len(keys))\n\n\t\tfor _, key := range keys {\n\t\t\tlist = append(list, KeyOutput{\n\t\t\t\tName: key.Name(),\n\t\t\t\tId:   keyEnc.FormatID(key.ID()),","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/keystore.go#L575-L611","documentation":"`ipfs key list` failed to build an encoder for the `--ipns-base` option value. KeyEncoderFromString only accepts bases like base36, base32, base58btc, base16, etc.; any unsupported or misspelled multibase name produces this wrapped error.","triggerScenarios":"`ipfs key list --ipns-base=base58` (invalid name), `--ipns-base=xyz`, or an empty/garbled value from a script variable.","commonSituations":"Old scripts written for pre-base36 defaults using `base58` shorthand instead of `base58btc`; typos in CI configuration; copying base names from other tools.","solutions":["Use a valid multibase name, e.g. `ipfs key list --ipns-base=base36` (default) or base58btc/base32/base16","Check the supported list in `ipfs key list --help` / multibase docs and fix the value in your script","Remove the flag entirely to use the default"],"exampleFix":"// before\n$ ipfs key list --ipns-base=base58\nError: cannot get key encoder: ...\n// after\n$ ipfs key list --ipns-base=base58btc","handlingStrategy":"validation","validationCode":"var validBases = map[string]bool{\"base36\": true, \"base32\": true, \"base58btc\": true, \"base58flickr\": true, \"base16\": true, \"base2\": true, \"identity\": true}\nif !validBases[ipnsBase] {\n    return fmt.Errorf(\"invalid --ipns-base %q\", ipnsBase)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the default (omit --ipns-base) unless you specifically need another base","Replace legacy `base58` shorthand with `base58btc` in old scripts","Test scripts with `ipfs key list --ipns-base=<value>` after changes"],"tags":["keystore","multibase","cli-usage","bad-argument"],"backgroundTag":"invalid-multibase","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"}