{"record":{"id":"946c6b146f74507d","repo":"ipfs/kubo","slug":"unrecognized-export-format-s","errorCode":null,"errorMessage":"unrecognized export format: %s","messagePattern":"unrecognized export format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/keystore.go","lineNumber":257,"sourceCode":"\t\t\tif secpKey, ok := stdKey.(*crypto.Secp256k1PrivateKey); ok {\n\t\t\t\t// crypto/x509 does not support the secp256k1 curve\n\t\t\t\tformattedKey, err = marshalSecp256k1PrivateKey(secpKey)\n\t\t\t} else {\n\t\t\t\t// This function supports a restricted list of public key algorithms,\n\t\t\t\t// but we generate and use only the RSA and ed25519 types that are on that list.\n\t\t\t\tformattedKey, err = x509.MarshalPKCS8PrivateKey(stdKey)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"marshalling key to PKCS8 format: %w\", err)\n\t\t\t}\n\n\t\tcase keyFormatLibp2pCleartextOption:\n\t\t\tformattedKey, err = crypto.MarshalPrivateKey(sk)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unrecognized export format: %s\", exportFormat)\n\t\t}\n\n\t\treturn res.Emit(bytes.NewReader(formattedKey))\n\t},\n\tPostRun: cmds.PostRunMap{\n\t\tcmds.CLI: func(res cmds.Response, re cmds.ResponseEmitter) error {\n\t\t\treq := res.Request()\n\n\t\t\tv, err := res.Next()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\toutReader, ok := v.(io.Reader)\n\t\t\tif !ok {\n\t\t\t\treturn e.New(e.TypeErr(outReader, v))\n\t\t\t}\n","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/keystore.go#L239-L275","documentation":"Switch-default guard in `ipfs key export`: the value of the --format option is not one of the supported formats (libp2p-protobuf-cleartext or pem-pkcs8-cleartext). A plain sentinel error identifying the unsupported format string the user passed.","triggerScenarios":"Thrown at core/commands/keystore.go:257 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use --format=libp2p-protobuf-cleartext for the native libp2p encoding","Use --format=pem-pkcs8-cleartext for a PEM-encoded PKCS8 private key","Omit --format to accept the default (libp2p-protobuf-cleartext)"],"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"}