{"record":{"id":"085a0b4b3d49eba4","repo":"apache/pulsar","slug":"unknown-producer-crypto-failure-action","errorCode":null,"errorMessage":"Unknown producer crypto failure action ","messagePattern":"Unknown producer 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":144,"sourceCode":"                return ConsumerCryptoFailureAction.FAIL;\n            case DISCARD:\n                return ConsumerCryptoFailureAction.DISCARD;\n            case CONSUME:\n                return ConsumerCryptoFailureAction.CONSUME;\n            default:\n                throw new RuntimeException(\n                        \"Unknown consumer protobuf failure action \" + action.name());\n        }\n    }\n\n    public static CryptoSpec.FailureAction getProtoFailureAction(ProducerCryptoFailureAction action) {\n        switch (action) {\n            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":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/CryptoUtils.java#L126-L162","documentation":"CryptoUtils.getProtoFailureAction(ProducerCryptoFailureAction) converts the client's producer enum back into the CryptoSpec.FailureAction representation, supporting FAIL and SEND. Any other ProducerCryptoFailureAction value throws this RuntimeException. It is the reverse-direction counterpart of getProducerCryptoFailureAction.","triggerScenarios":"Calling convert()/convertFromSpec paths that invoke getProtoFailureAction with a producer failure action outside {FAIL, SEND} — e.g. a new enum constant from a newer client library serialized into a function config and read by an older utils version.","commonSituations":"Function configs produced by a newer Pulsar CLI/client being read by an older broker/worker; programmatically built configs using an unexpected enum; corrupted or hand-edited function metadata.","solutions":["Use only FAIL or SEND for producer failure actions","Upgrade the functions-utils/broker to match the client version that wrote the config","Re-export or correct the function config with a supported enum value"],"exampleFix":"// before\nproducerAction = ProducerCryptoFailureAction.LOG; // hypothetical unsupported value\n// after\nproducerAction = ProducerCryptoFailureAction.FAIL;","handlingStrategy":"validation","validationCode":"if (action != ProducerCryptoFailureAction.FAIL && action != ProducerCryptoFailureAction.SEND) {\n    throw new IllegalArgumentException(\"Unsupported producer action for conversion: \" + action);\n}","typeGuard":null,"tryCatchPattern":"try {\n    CryptoSpec.FailureAction spec = CryptoUtils.getProtoFailureAction(producerAction);\n} catch (RuntimeException e) {\n    log.error(\"Producer action not convertible; falling back to FAIL\", e);\n    CryptoSpec.FailureAction spec = CryptoSpec.FailureAction.FAIL;\n}","preventionTips":["Only round-trip FAIL/SEND producer actions through convert()","Rebuild configs with a client version matching the deployed broker","Never hand-edit enum values in serialized function configs","Test config conversion after every Pulsar upgrade"],"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"}