ipfs/kubo · error
unrecognized export format: %s
Error message
unrecognized export format: %s
What it means
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.
Source
Thrown at core/commands/keystore.go:257
if secpKey, ok := stdKey.(*crypto.Secp256k1PrivateKey); ok {
// crypto/x509 does not support the secp256k1 curve
formattedKey, err = marshalSecp256k1PrivateKey(secpKey)
} else {
// This function supports a restricted list of public key algorithms,
// but we generate and use only the RSA and ed25519 types that are on that list.
formattedKey, err = x509.MarshalPKCS8PrivateKey(stdKey)
}
if err != nil {
return fmt.Errorf("marshalling key to PKCS8 format: %w", err)
}
case keyFormatLibp2pCleartextOption:
formattedKey, err = crypto.MarshalPrivateKey(sk)
if err != nil {
return err
}
default:
return fmt.Errorf("unrecognized export format: %s", exportFormat)
}
return res.Emit(bytes.NewReader(formattedKey))
},
PostRun: cmds.PostRunMap{
cmds.CLI: func(res cmds.Response, re cmds.ResponseEmitter) error {
req := res.Request()
v, err := res.Next()
if err != nil {
return err
}
outReader, ok := v.(io.Reader)
if !ok {
return e.New(e.TypeErr(outReader, v))
}
View on GitHub (pinned to 329838acdf)
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)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/commands/keystore.go:257 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/946c6b146f74507d.
Report an issue: GitHub.