rmoff's random ramblings
about talks

kafka.common.KafkaException: No key found on line 1

Published May 12, 2017 by in Apache Kafka, Key, Spelling, Pebcak at https://preview.rmoff.net/2017/05/12/kafka.common.kafkaexception-no-key-found-on-line-1/

A very silly PEBCAK problem this one, but Google hits weren’t so helpful so here goes.

Running a console producer, specifying keys:

kafka-console-producer \
--broker-list localhost:9092 \
--topic test_topic \
--property parse.key=true \
--property key.seperator=,

Failed when I entered a key/value:

1,foo
kafka.common.KafkaException: No key found on line 1: 1,foo
        at kafka.tools.ConsoleProducer$LineMessageReader.readMessage(ConsoleProducer.scala:314)
        at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:55)
        at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala)

kafka.common.KafkaException: No key found on line … but I specified the key, didn’t I?

It would help if I could spell … key.seperator isn’t a valid property to configure. separator on the other hand, is:

kafka-console-producer \
--broker-list localhost:9092 \
--topic test_topic \
--property parse.key=true \
--property key.separator=,

Much better.


Robin Moffatt

Robin Moffatt works on the DevRel team at Confluent. He likes writing about himself in the third person, eating good breakfasts, and drinking good beer.

Story logo

© 2025