{"record":{"id":"8313ee4634467fd6","repo":"apache/pulsar","slug":"failed-at-fetching-schema-info-for-schemautils-ge","errorCode":null,"errorMessage":"Failed at fetching schema info for <SchemaUtils.getStringSchemaVersion(schemaVersion)>","messagePattern":"Failed at fetching schema info for <SchemaUtils\\.getStringSchemaVersion\\(schemaVersion\\)>","errorType":"exception","errorClass":"SerializationException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/AbstractMultiVersionReader.java","lineNumber":130,"sourceCode":"     * @param schemaVersion the provided schema version\n     * @return the schema reader for decoding messages encoded by the provided schema version.\n     */\n    protected abstract SchemaReader<T> loadReader(BytesSchemaVersion schemaVersion);\n\n    /**\n     * TODO: think about how to make this async.\n     */\n    protected SchemaInfo getSchemaInfoByVersion(byte[] schemaVersion) {\n        try {\n            return schemaInfoProvider.getSchemaByVersion(schemaVersion).get();\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new SerializationException(\n                    \"Interrupted at fetching schema info for \" + SchemaUtils.getStringSchemaVersion(schemaVersion),\n                    e\n            );\n        } catch (ExecutionException e) {\n            throw new SerializationException(\n                    \"Failed at fetching schema info for \" + SchemaUtils.getStringSchemaVersion(schemaVersion),\n                    e.getCause()\n            );\n        }\n    }\n}\n","sourceCodeStart":112,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/AbstractMultiVersionReader.java#L112-L137","documentation":"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).","triggerScenarios":"Calling getSchemaInfoByVersion/read when the CompletableFuture from schemaInfoProvider.getSchemaByVersion completes exceptionally — HTTP 404 for missing schema version, broker errors, auth failures.","commonSituations":"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.","solutions":["Look at e.getCause() in the SerializationException for the real broker/registry error","Verify the schema version exists: pulsar-admin schemas get <topic>","Re-upload the missing schema or configure a reader schema compatible with old messages","Check client permissions for schema read operations on the topic","Ensure broker connectivity and retry after transient failures"],"exampleFix":"// before\nSchemaInfo info = reader.getSchemaInfoByVersion(version); // SerializationException\n// after\ntry {\n    SchemaInfo info = reader.getSchemaInfoByVersion(version);\n} catch (SerializationException e) {\n    LOGGER.warn(\"Schema fetch failed for version \" + version, e.getCause());\n    // re-upload schema or attach compatible reader schema\n}","handlingStrategy":"try-catch","validationCode":"// verify version exists before decode:\n// pulsar-admin schemas get <topic> / broker HTTP GET /admin/v2/schemas/<topic>/versions/<id>","typeGuard":"null","tryCatchPattern":"try {\n    SchemaInfo info = reader.getSchemaInfoByVersion(version);\n} catch (SerializationException e) {\n    Throwable cause = e.getCause();\n    log.error(\"Schema fetch failed for version {} cause {}\", version, cause);\n    // re-upload schema or use compatible reader schema, then retry\n}","preventionTips":["Inspect e.getCause() — the real registry/broker error is preserved there","Retain all schema versions on topics with long retention consumers","Grant clients schema read permissions on the topic","Add monitoring/alerting on schema-not-found errors from the broker"],"tags":["pulsar","schema","schema-version","fetch-failed"],"backgroundTag":"schema-fetch-failed","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}