{"record":{"id":"89757dc2ac9dc289","repo":"prestodb/presto","slug":"kafka-producer-error","errorCode":"KAFKA_PRODUCER_ERROR","errorMessage":"%d producer record('s) failed to send","messagePattern":"(.+?) producer record\\('s\\) failed to send","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaPageSink.java","lineNumber":125,"sourceCode":"        }\n        return NOT_BLOCKED;\n    }\n\n    @Override\n    public CompletableFuture<Collection<Slice>> finish()\n    {\n        producer.flush();\n        producer.close();\n        try {\n            keyEncoder.close();\n            messageEncoder.close();\n        }\n        catch (IOException e) {\n            throw new UncheckedIOException(\"Failed to close row encoders\", e);\n        }\n\n        if (errorCounter.getErrorCount() > 0) {\n            throw new PrestoException(KAFKA_PRODUCER_ERROR, format(\"%d producer record('s) failed to send\", errorCounter.getErrorCount()));\n        }\n        return completedFuture(ImmutableList.of());\n    }\n\n    @Override\n    public void abort()\n    {\n        producer.close();\n    }\n}\n","sourceCodeStart":107,"sourceCodeEnd":136,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaPageSink.java#L107-L136","documentation":"Thrown at the end of KafkaPageSink.finish() after the producer is flushed and closed: the sink's error counter recorded one or more async send failures during the write, so the query is failed instead of committing an incomplete set of Kafka records. The count of failed producer records is included in the message.","triggerScenarios":"Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaPageSink.java:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check broker availability and network connectivity from the Presto worker to the Kafka cluster","Inspect producer errors logged by KafkaProducer callbacks; the count comes from the errorCounter incremented on failed send callbacks","Verify topic exists, is writable, and replication/ack settings are satisfiable","Reduce backpressure: check request.timeout.ms, delivery.timeout.ms, buffer.memory, and max.block.ms producer settings"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}