apache/pulsar · error · SerializationException

Failed at fetching schema info for…

Error message

Failed at fetching schema info for <SchemaUtils.getStringSchemaVersion(schemaVersion)>

What it means

getSchemaInfoByVersion wraps ExecutionException from the async schema lookup and rethrows it as SerializationException 'Failed at fetching schema info for <version>' with the original cause. This means the schema info provider failed to return the schema for that version (broker error, missing schema, permission issue).

Solutions

  1. Look at e.getCause() in the SerializationException for the real broker/registry error
  2. Verify the schema version exists: pulsar-admin schemas get <topic>
  3. Re-upload the missing schema or configure a reader schema compatible with old messages
  4. Check client permissions for schema read operations on the topic
  5. Ensure broker connectivity and retry after transient failures

Example fix

// before
SchemaInfo info = reader.getSchemaInfoByVersion(version); // SerializationException
// after
try {
    SchemaInfo info = reader.getSchemaInfoByVersion(version);
} catch (SerializationException e) {
    LOGGER.warn("Schema fetch failed for version " + version, e.getCause());
    // re-upload schema or attach compatible reader schema
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify version exists before decode:
// pulsar-admin schemas get <topic> / broker HTTP GET /admin/v2/schemas/<topic>/versions/<id>

Type guard

null

Try / catch

try {
    SchemaInfo info = reader.getSchemaInfoByVersion(version);
} catch (SerializationException e) {
    Throwable cause = e.getCause();
    log.error("Schema fetch failed for version {} cause {}", version, cause);
    // re-upload schema or use compatible reader schema, then retry
}

Prevention

When it happens

Trigger: Calling getSchemaInfoByVersion/read when the CompletableFuture from schemaInfoProvider.getSchemaByVersion completes exceptionally — HTTP 404 for missing schema version, broker errors, auth failures.

Common situations: Consuming messages whose schema version was deleted from the topic; broker schema registry unavailable; client lacks schema read permission; schema version bytes corrupted; topic recreated without the old schema.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/8313ee4634467fd6. Report an issue: GitHub.

Appendix: source

Thrown at pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/AbstractMultiVersionReader.java:130

     * @param schemaVersion the provided schema version
     * @return the schema reader for decoding messages encoded by the provided schema version.
     */
    protected abstract SchemaReader<T> loadReader(BytesSchemaVersion schemaVersion);

    /**
     * TODO: think about how to make this async.
     */
    protected SchemaInfo getSchemaInfoByVersion(byte[] schemaVersion) {
        try {
            return schemaInfoProvider.getSchemaByVersion(schemaVersion).get();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new SerializationException(
                    "Interrupted at fetching schema info for " + SchemaUtils.getStringSchemaVersion(schemaVersion),
                    e
            );
        } catch (ExecutionException e) {
            throw new SerializationException(
                    "Failed at fetching schema info for " + SchemaUtils.getStringSchemaVersion(schemaVersion),
                    e.getCause()
            );
        }
    }
}

View on GitHub (pinned to 820761864e)