apache/pulsar · error · RuntimeException
Unknown consumer protobuf failure action
Error message
Unknown consumer protobuf failure action
What it means
CryptoUtils.getConsumerCryptoFailureAction maps a CryptoSpec.FailureAction to the client's ConsumerCryptoFailureAction, handling FAIL, DISCARD, and CONSUME. Any other value — typically a producer-only action like SEND — is unsupported and throws this RuntimeException. It signals a consumer crypto spec populated with an invalid failure action.
Source
Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/CryptoUtils.java:132
return ProducerCryptoFailureAction.FAIL;
case SEND:
return ProducerCryptoFailureAction.SEND;
default:
throw new RuntimeException(
"Unknown producer protobuf failure action " + action.name());
}
}
public static ConsumerCryptoFailureAction getConsumerCryptoFailureAction(CryptoSpec.FailureAction action) {
switch (action) {
case FAIL:
return ConsumerCryptoFailureAction.FAIL;
case DISCARD:
return ConsumerCryptoFailureAction.DISCARD;
case CONSUME:
return ConsumerCryptoFailureAction.CONSUME;
default:
throw new RuntimeException(
"Unknown consumer protobuf failure action " + action.name());
}
}
public static CryptoSpec.FailureAction getProtoFailureAction(ProducerCryptoFailureAction action) {
switch (action) {
case FAIL:
return CryptoSpec.FailureAction.FAIL;
case SEND:
return CryptoSpec.FailureAction.SEND;
default:
throw new RuntimeException("Unknown producer crypto failure action " + action);
}
}
public static CryptoSpec.FailureAction getProtoFailureAction(ConsumerCryptoFailureAction action) {
switch (action) {
case FAIL:View on GitHub (pinned to 820761864e)
Solutions
- Set the consumer's CryptoSpec failureAction to FAIL, DISCARD, or CONSUME only
- Use getProducerCryptoFailureAction for producer specs (valid values FAIL/SEND)
- Upgrade/align Pulsar client and functions-utils versions if a new enum value was introduced
Example fix
// before cryptoSpec.setFailureAction(CryptoSpec.FailureAction.SEND); // producer-only // after cryptoSpec.setFailureAction(CryptoSpec.FailureAction.CONSUME); // valid for consumer
Defensive patterns
Strategy: validation
Validate before calling
if (action != CryptoSpec.FailureAction.FAIL
&& action != CryptoSpec.FailureAction.DISCARD
&& action != CryptoSpec.FailureAction.CONSUME) {
throw new IllegalArgumentException("Consumer failureAction must be FAIL, DISCARD, or CONSUME, got " + action);
} Type guard
boolean isConsumerAction(CryptoSpec.FailureAction a) {
return a == CryptoSpec.FailureAction.FAIL
|| a == CryptoSpec.FailureAction.DISCARD
|| a == CryptoSpec.FailureAction.CONSUME;
} Try / catch
try {
ConsumerCryptoFailureAction mapped = CryptoUtils.getConsumerCryptoFailureAction(action);
} catch (RuntimeException e) {
log.warn("Unsupported consumer failure action, defaulting to DISCARD", e);
ConsumerCryptoFailureAction mapped = ConsumerCryptoFailureAction.DISCARD;
} Prevention
- Only set FAIL, DISCARD, or CONSUME in consumer crypto specs
- Use separate spec builders for producer and consumer crypto
- Keep Pulsar versions aligned across CLI, client, and worker
- Validate the crypto spec before calling convertFromSpec
When it happens
Trigger: Calling getConsumerCryptoFailureAction (via convertFromSpec) with a CryptoSpec.FailureAction value of SEND or any other non-consumer action, or an enum constant added in a newer version not known to this code.
Common situations: Reusing a producer crypto spec for a consumer; generated/validated-but-wrong config files; mixed Pulsar versions where a new FailureAction exists on one side but not the converter.
Related errors
- Unknown producer protobuf failure action
- Unknown producer crypto failure action
- Unknown consumer crypto failure action
- The ${alg.name()} algorithm does not support Key Pairs.
- Illegal base64 character or Key file ${keyConfUrl} doesn't e
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/844aefb7767f8a1e.
Report an issue: GitHub.