apache/pulsar · error · RuntimeException
Can't get generic schema for topic <schemaInfoProvider.getTo
Error message
Can't get generic schema for topic <schemaInfoProvider.getTopicName()>
What it means
AbstractMultiVersionReader.read wraps the reader-cache lookup (getSchemaReader -> readerCache.get) which can fail with ExecutionException while resolving the schema for a version. The original cause is logged and a RuntimeException 'Can't get generic schema for topic X' is thrown, meaning the generic schema reader could not be built for the message's schema version on that topic.
Source
Thrown at pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/AbstractMultiVersionReader.java:79
return providerSchemaReader.read(bytes);
}
@Override
public T read(InputStream inputStream) {
return providerSchemaReader.read(inputStream);
}
@Override
public T read(InputStream inputStream, byte[] schemaVersion) {
try {
return schemaVersion == null ? read(inputStream) :
getSchemaReader(schemaVersion).read(inputStream);
} catch (ExecutionException e) {
log.error().attr("topic", schemaInfoProvider.getTopicName())
.attr("version", Hex.encodeHexString(schemaVersion))
.exception(e)
.log("Can't get generic schema");
throw new RuntimeException("Can't get generic schema for topic " + schemaInfoProvider.getTopicName());
}
}
public SchemaReader<T> getSchemaReader(byte[] schemaVersion) throws ExecutionException {
return readerCache.get(BytesSchemaVersion.of(schemaVersion));
}
@Override
public T read(byte[] bytes, byte[] schemaVersion) {
try {
return schemaVersion == null ? read(bytes) :
getSchemaReader(schemaVersion).read(bytes);
} catch (ExecutionException | AvroTypeException e) {
if (e instanceof AvroTypeException) {
throw new SchemaSerializationException(e);
}
log.error().attr("topic", schemaInfoProvider.getTopicName())
.attr("version", Hex.encodeHexString(schemaVersion))View on GitHub (pinned to 820761864e)
Solutions
- Check the logged cause (attr topic/version) to see the underlying ExecutionException reason
- Verify the schema still exists on the topic (pulsar-admin schemas get)
- Recreate/reset the consumer so it fetches current schema versions
- Ensure the client can reach the broker and has schema read permissions
- If the schema was deleted, re-upload the schema or use a reader schema compatible with old data
Example fix
// before
T value = multiVersionReader.read(messageData); // RuntimeException
// after
try {
T value = multiVersionReader.read(messageData);
} catch (RuntimeException e) {
log.warn("Generic schema unavailable for topic {}, falling back", topic, e);
// re-fetch schema / reconnect consumer
} Defensive patterns
Strategy: try-catch
Validate before calling
byte[] latest = ((PulsarClientImpl) client).getSchemaLookupService(); // ensure topic schema exists before reading: // pulsar-admin schemas get <topic> or SchemaInfoProvider fetch of current version
Type guard
null
Try / catch
try {
T value = multiVersionReader.read(messageData);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Can't get generic schema")) {
log.warn("Schema reader unavailable for topic {}, version mismatch", topic, e);
// refresh consumer / re-upload schema
} else {
throw e;
}
} Prevention
- Never delete topic schemas while consumers still read old data
- Verify schema versions exist with pulsar-admin schemas get before consuming
- Monitor broker connectivity and schema registry health
- Set an appropriate reader schema to tolerate version drift
When it happens
Trigger: Calling read(byte[]/ByteBuf) when the reader cache loader throws while fetching schema info for the message's schema version — e.g. the schema version does not exist, the broker returns an error, or the schema info provider fails asynchronously.
Common situations: Schema was deleted from the topic while old messages still exist; broker connectivity/permission problems during schema lookup; consumer reading data written before a schema change whose version is no longer retrievable; corrupted schema version bytes.
Related errors
- Schema typed [<schema.getClass().getName()>], simple-type:[<
- Generic schema is not supported on schema type <schemaInfo.g
- Failed at fetching schema info for <SchemaUtils.getStringSch
- Can not enable for all producers but denies for replicators,
- Failed to add schema to an active topic with empty(BYTES) sc
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/5f40e21af3892576.
Report an issue: GitHub.