{"record":{"id":"5f40e21af3892576","repo":"apache/pulsar","slug":"can-t-get-generic-schema-for-topic-schemainfoprov","errorCode":null,"errorMessage":"Can't get generic schema for topic <schemaInfoProvider.getTopicName()>","messagePattern":"Can't get generic schema for topic <schemaInfoProvider\\.getTopicName\\(\\)>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/AbstractMultiVersionReader.java","lineNumber":79,"sourceCode":"        return providerSchemaReader.read(bytes);\n    }\n\n    @Override\n    public T read(InputStream inputStream) {\n        return providerSchemaReader.read(inputStream);\n    }\n\n    @Override\n    public T read(InputStream inputStream, byte[] schemaVersion) {\n        try {\n            return schemaVersion == null ? read(inputStream) :\n                    getSchemaReader(schemaVersion).read(inputStream);\n        } catch (ExecutionException e) {\n            log.error().attr(\"topic\", schemaInfoProvider.getTopicName())\n                    .attr(\"version\", Hex.encodeHexString(schemaVersion))\n                    .exception(e)\n                    .log(\"Can't get generic schema\");\n            throw new RuntimeException(\"Can't get generic schema for topic \" + schemaInfoProvider.getTopicName());\n        }\n    }\n\n    public SchemaReader<T> getSchemaReader(byte[] schemaVersion) throws ExecutionException {\n        return readerCache.get(BytesSchemaVersion.of(schemaVersion));\n    }\n\n    @Override\n    public T read(byte[] bytes, byte[] schemaVersion) {\n        try {\n            return schemaVersion == null ? read(bytes) :\n                    getSchemaReader(schemaVersion).read(bytes);\n        } catch (ExecutionException | AvroTypeException e) {\n            if (e instanceof AvroTypeException) {\n                throw new SchemaSerializationException(e);\n            }\n            log.error().attr(\"topic\", schemaInfoProvider.getTopicName())\n                    .attr(\"version\", Hex.encodeHexString(schemaVersion))","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/AbstractMultiVersionReader.java#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nT value = multiVersionReader.read(messageData); // RuntimeException\n// after\ntry {\n    T value = multiVersionReader.read(messageData);\n} catch (RuntimeException e) {\n    log.warn(\"Generic schema unavailable for topic {}, falling back\", topic, e);\n    // re-fetch schema / reconnect consumer\n}","handlingStrategy":"try-catch","validationCode":"byte[] latest = ((PulsarClientImpl) client).getSchemaLookupService();\n// ensure topic schema exists before reading:\n// pulsar-admin schemas get <topic> or SchemaInfoProvider fetch of current version","typeGuard":"null","tryCatchPattern":"try {\n    T value = multiVersionReader.read(messageData);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Can't get generic schema\")) {\n        log.warn(\"Schema reader unavailable for topic {}, version mismatch\", topic, e);\n        // refresh consumer / re-upload schema\n    } else {\n        throw e;\n    }\n}","preventionTips":["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"],"tags":["pulsar","schema","generic-schema","schema-version"],"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-14T00:17:10.932Z"}