Weichu Liu created KAFKA-8679:
---------------------------------

             Summary: kafka-topics.sh --describe with --zookeeper throws error 
when there is no topic
                 Key: KAFKA-8679
                 URL: https://issues.apache.org/jira/browse/KAFKA-8679
             Project: Kafka
          Issue Type: Bug
            Reporter: Weichu Liu


h3. Step to Reproduce:

First, start a Kafka server (2.2.0+), with no topic on it.

Then run `kafka-topics.sh --describe --zookeeper ...:2181` to get topic details

h3. Expected Behavior

Expected Behavior should be the command prints nothing and return 0.

h3. Actual Behavior

The command throws an exception and exit with 1.

{code}
$ kafka_2.12-2.2.1/bin/kafka-topics.sh --describe --zookeeper localhost:2181
Error while executing topic command : Topics in [] does not exist
[2019-07-18 06:29:21,336] ERROR java.lang.IllegalArgumentException: Topics in 
[] does not exist
        at 
kafka.admin.TopicCommand$.kafka$admin$TopicCommand$$ensureTopicExists(TopicCommand.scala:416)
        at 
kafka.admin.TopicCommand$ZookeeperTopicService.describeTopic(TopicCommand.scala:332)
        at kafka.admin.TopicCommand$.main(TopicCommand.scala:66)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)
 (kafka.admin.TopicCommand$)
{code}

h3. Others

IIRC, the version before 2.2.0 did not throw exceptions.
Also, {{--describing}} with {{--bootstrap-server}} will exit 0 and print 
nothing.
Also {{--list}} with either {{--bootstrap-server}} and {{--zookeeper}} will 
also exit 0 and prints nothing.

I did some quick search and seems this issue is introduced by 
https://issues.apache.org/jira/browse/KAFKA-7054. I didn't check which exact 
line caused the exception. Hope that will help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to