{"record":{"id":"33bc5ed9350a09b9","repo":"prestodb/presto","slug":"kafka-schema-error","errorCode":"KAFKA_SCHEMA_ERROR","errorMessage":"Unable to read data schema at '%s'","messagePattern":"Unable to read data schema at '(.+?)'","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaPageSinkProvider.java","lineNumber":110,"sourceCode":"\n        return new KafkaPageSink(\n                handle.getSchemaName(),\n                handle.getTopicName(),\n                handle.getColumns(),\n                keyEncoder,\n                messageEncoder,\n                producerFactory,\n                kafkaClusterMetadataSupplier);\n    }\n\n    private Optional<String> getDataSchema(Optional<String> dataSchemaLocation)\n    {\n        return dataSchemaLocation.map(location -> {\n            try {\n                return new String(Files.readAllBytes(Paths.get(location)));\n            }\n            catch (IOException e) {\n                throw new PrestoException(KAFKA_SCHEMA_ERROR, format(\"Unable to read data schema at '%s'\", dataSchemaLocation.get()), e);\n            }\n        });\n    }\n}\n","sourceCodeStart":92,"sourceCodeEnd":115,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaPageSinkProvider.java#L92-L115","documentation":"getDataSchema reads the table's configured dataSchemaLocation from local disk; if Files.readAllBytes throws IOException (missing file, permissions, path is a directory), the connector wraps it in a PrestoException with code KAFKA_SCHEMA_ERROR. The connector cannot build the Avro data schema needed to encode/decode records.","triggerScenarios":"kafka.table-description data schema location (or table's dataSchemaLocation property) points to a file that does not exist or is unreadable at the moment keyEncoder/messageEncoder request the schema.","commonSituations":"Typo or wrong absolute path in table description JSON; schema file deleted from workers (file only exists on coordinator); permissions after container image change; relative path resolved against a different working directory on a worker node.","solutions":["Verify the file exists and is readable on every node that runs the query: ls -l <dataSchemaLocation>","Use a URI-based (hdfs/http) schema location or ship the schema inside the table description JSON instead of a local file path","Fix permissions/ownership of the schema file","Correct the dataSchemaLocation value in the Kafka table description"],"exampleFix":"// before (table description)\n\"dataSchema\": \"/etc/kafka/schemas/order.avsc\"\n// after - inline schema or valid path\n\"dataSchema\": {\"type\":\"record\",\"name\":\"order\",\"fields\":[...]}","handlingStrategy":"validation","validationCode":"java.nio.file.Path p = java.nio.file.Paths.get(dataSchemaLocation);\nif (!java.nio.file.Files.isReadable(p))\n    throw new IllegalStateException(\"Data schema not readable: \" + p);","typeGuard":"null","tryCatchPattern":"try { ... } catch (PrestoException e) {\n  if (KAFKA_SCHEMA_ERROR.toErrorCode().getCode().equals(e.getErrorCode().getCode())) {\n    // fix/verify dataSchemaLocation, then retry\n  }\n}","preventionTips":["Use absolute paths valid on all worker nodes","Prefer inlining the schema in the table description JSON","Add a deployment check that schema files exist on every worker","Keep schema files outside ephemeral container layers"],"tags":["kafka","avro","schema","io","presto-connector"],"backgroundTag":"schema-file-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}