apache/pulsar · error · RuntimeException
No key schema info or value schema info : key = ${keySchema.
Error message
No key schema info or value schema info : key = ${keySchema.getSchemaInfo()}, value = ${valueSchema.getSchemaInfo()} What it means
After decoding the KeyValueSchemaInfo from the topic schema, KeyValueSchemaImpl.configureSchemaInfo pushes the key/value SchemaInfo into the subschemas and then derives its own schemaInfo. If that derivation yields null, the key or value schema info was missing/invalid, so it throws a RuntimeException naming both schema infos.
Source
Thrown at pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/KeyValueSchemaImpl.java:304
@Override
public void configureSchemaInfo(String topicName,
String componentName,
SchemaInfo schemaInfo) {
if (schemaInfo == null) {
log.info().attr("topic", topicName)
.log("KeyValueSchema starting from null SchemaInfo."
+ " This means that the topic still has"
+ " not a schema");
return;
}
KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo = KeyValueSchemaInfo.decodeKeyValueSchemaInfo(schemaInfo);
keySchema.configureSchemaInfo(topicName, "key", kvSchemaInfo.getKey());
valueSchema.configureSchemaInfo(topicName, "value", kvSchemaInfo.getValue());
configureKeyValueSchemaInfo();
if (null == this.schemaInfo) {
throw new RuntimeException(
"No key schema info or value schema info : key = " + keySchema.getSchemaInfo()
+ ", value = " + valueSchema.getSchemaInfo());
}
}
@Override
public Schema<KeyValue<K, V>> clone() {
return KeyValueSchemaImpl.of(keySchema.clone(), valueSchema.clone(), keyValueEncodingType);
}
private void buildKeyValueSchemaInfo() {
this.schemaInfo = KeyValueSchemaInfo.encodeKeyValueSchemaInfo(
keySchema, valueSchema, keyValueEncodingType
);
}
private void configureKeyValueSchemaInfo() {
buildKeyValueSchemaInfo();View on GitHub (pinned to 820761864e)
Solutions
- Inspect the topic's schema info (admin schemas get) and re-upload a well-formed KeyValue schema with non-null key and value SchemaInfo
- Ensure both key and value schemas have valid SchemaType and properties when building KeyValueSchemaInfo.encodeKeyValueSchemaInfo
- Upgrade/align the client version so KeyValueSchemaInfo encoding/decoding matches what the broker stored
Example fix
// before SchemaInfo kvInfo = SchemaInfoImpl.builder().schema(KeyValueSchemaInfo.encodeKeyValueSchemaInfo(null, null)).build(); // null sub-schema infos // after SchemaInfo kvInfo = SchemaInfoImpl.builder().schema(KeyValueSchemaInfo.encodeKeyValueSchemaInfo(keySchemaInfo, valueSchemaInfo)).build();
Defensive patterns
Strategy: try-catch
Validate before calling
KeyValue<SchemaInfo, SchemaInfo> kv = KeyValueSchemaInfo.decodeKeyValueSchemaInfo(schemaInfo);
if (kv == null || kv.getKey() == null || kv.getValue() == null) throw new IllegalStateException("KeyValue schema info missing key or value SchemaInfo"); Try / catch
try { schema.configureSchemaInfo(topic, "key_value", schemaInfo); } catch (RuntimeException e) { if (e.getMessage().startsWith("No key schema info or value schema info")) { reUploadSchema(topic); } else throw e; } Prevention
- Inspect `pulsar-admin schemas get` output before relying on a topic's KeyValue schema
- Re-upload the KeyValue schema if key/value sub-infos are empty
- Keep client versions consistent across producers and consumers
When it happens
Trigger: Calling configureSchemaInfo(topicName, schemaInfo) (via fetchSchemaIfNeeded) with a KeyValue SchemaInfo whose decoded key or value SchemaInfo is null or has a null/unknown type, so configureKeyValueSchemaInfo() cannot build a schemaInfo.
Common situations: A KeyValue schema uploaded with a malformed/empty key or value SchemaInfo; schema info lost when copying schema metadata between topics; client versions producing subtly different KeyValueSchemaInfo encodings.
Related errors
- AutoConsumeSchema is not supported with schemaId
- The schema is not a KeyValueSchema
- External schema cannot be used with other Pulsar struct sche
- This method cannot be used under this SEPARATED encoding typ
- Can't get accurate schema information for ${topicName} using
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/2774c741156f920a.
Report an issue: GitHub.