{"record":{"id":"5d11114f76b72b25","repo":"apache/pulsar","slug":"unknown-consumer-crypto-failure-action","errorCode":null,"errorMessage":"Unknown consumer crypto failure action ","messagePattern":"Unknown consumer crypto failure action ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/CryptoUtils.java","lineNumber":157,"sourceCode":"            case FAIL:\n                return CryptoSpec.FailureAction.FAIL;\n            case SEND:\n                return CryptoSpec.FailureAction.SEND;\n            default:\n                throw new RuntimeException(\"Unknown producer crypto failure action \" + action);\n        }\n    }\n\n    public static CryptoSpec.FailureAction getProtoFailureAction(ConsumerCryptoFailureAction action) {\n        switch (action) {\n            case FAIL:\n                return CryptoSpec.FailureAction.FAIL;\n            case DISCARD:\n                return CryptoSpec.FailureAction.DISCARD;\n            case CONSUME:\n                return CryptoSpec.FailureAction.CONSUME;\n            default:\n                throw new RuntimeException(\"Unknown consumer crypto failure action \" + action);\n        }\n    }\n\n}\n","sourceCodeStart":139,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/CryptoUtils.java#L139-L162","documentation":"CryptoUtils.getProtoFailureAction(ConsumerCryptoFailureAction) converts the client's consumer enum into CryptoSpec.FailureAction, supporting FAIL, DISCARD, and CONSUME. Any other ConsumerCryptoFailureAction value throws this RuntimeException. This is the reverse mapping of getConsumerCryptoFailureAction.","triggerScenarios":"Calling convert()/convertFromSpec paths that invoke getProtoFailureAction with a consumer failure action outside {FAIL, DISCARD, CONSUME}, typically a value added by a newer client library than the code performing the conversion.","commonSituations":"Version skew between the component that produced the function/crypto spec and the one converting it; hand-edited configs; new enum constants not yet present in the deployed Pulsar version.","solutions":["Use only FAIL, DISCARD, or CONSUME for consumer failure actions","Align client, broker, and functions-utils versions","Regenerate or fix the crypto spec with a supported enum value"],"exampleFix":"// before\nconsumerAction = ConsumerCryptoFailureAction.RECONNECT; // unsupported\n// after\nconsumerAction = ConsumerCryptoFailureAction.DISCARD;","handlingStrategy":"validation","validationCode":"if (action != ConsumerCryptoFailureAction.FAIL\n        && action != ConsumerCryptoFailureAction.DISCARD\n        && action != ConsumerCryptoFailureAction.CONSUME) {\n    throw new IllegalArgumentException(\"Unsupported consumer action for conversion: \" + action);\n}","typeGuard":null,"tryCatchPattern":"try {\n    CryptoSpec.FailureAction spec = CryptoUtils.getProtoFailureAction(consumerAction);\n} catch (RuntimeException e) {\n    log.error(\"Consumer action not convertible; falling back to DISCARD\", e);\n    CryptoSpec.FailureAction spec = CryptoSpec.FailureAction.DISCARD;\n}","preventionTips":["Only round-trip FAIL/DISCARD/CONSUME consumer actions","Upgrade broker and client together so enum sets match","Regenerate function configs after version upgrades rather than reusing old serialized metadata","Reject unknown enum values at config load time"],"tags":["enum","crypto","mapping","version-compatibility"],"backgroundTag":"unsupported-enum-value","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}