apache/pulsar · error · RuntimeException
Unknown producer crypto failure action
Error message
Unknown producer crypto failure action
What it means
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.
Source
Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/CryptoUtils.java:144
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:
return CryptoSpec.FailureAction.FAIL;
case DISCARD:
return CryptoSpec.FailureAction.DISCARD;
case CONSUME:
return CryptoSpec.FailureAction.CONSUME;
default:
throw new RuntimeException("Unknown consumer crypto failure action " + action);
}
}
}
View on GitHub (pinned to 820761864e)
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
Example fix
// before producerAction = ProducerCryptoFailureAction.LOG; // hypothetical unsupported value // after producerAction = ProducerCryptoFailureAction.FAIL;
Defensive patterns
Strategy: validation
Validate before calling
if (action != ProducerCryptoFailureAction.FAIL && action != ProducerCryptoFailureAction.SEND) {
throw new IllegalArgumentException("Unsupported producer action for conversion: " + action);
} Try / catch
try {
CryptoSpec.FailureAction spec = CryptoUtils.getProtoFailureAction(producerAction);
} catch (RuntimeException e) {
log.error("Producer action not convertible; falling back to FAIL", e);
CryptoSpec.FailureAction spec = CryptoSpec.FailureAction.FAIL;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown consumer crypto failure action
- Unknown producer protobuf failure action
- Unknown consumer protobuf failure action
- Unrecognized runtime:
- Unrecognized processing guarantee:
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/085a0b4b3d49eba4.
Report an issue: GitHub.