{"record":{"id":"8522682d0f64e1ea","repo":"quarkusio/quarkus","slug":"topic-doesn-t-exist","errorCode":null,"errorMessage":"Topic doesn't exist: ","messagePattern":"Topic doesn't exist: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"integration-tests/compose-devservices/src/main/java/io/quarkus/it/compose/devservices/kafka/KafkaAdminManager.java","lineNumber":67,"sourceCode":"                admin.createTopics(List.of(new NewTopic(topic, partitions, (short) 1))).all()\n                        .get(2000, TimeUnit.MILLISECONDS);\n            }\n        } catch (InterruptedException | ExecutionException | TimeoutException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public int partitions(String topic) {\n        TopicDescription topicDescription;\n        try {\n            Map<String, TopicDescription> partitions = admin.describeTopics(Collections.singletonList(topic))\n                    .allTopicNames().get(2000, TimeUnit.MILLISECONDS);\n            topicDescription = partitions.get(topic);\n        } catch (InterruptedException | ExecutionException | TimeoutException e) {\n            throw new RuntimeException(e);\n        }\n        if (topicDescription == null) {\n            throw new IllegalArgumentException(\"Topic doesn't exist: \" + topic);\n        }\n        return topicDescription.partitions().size();\n    }\n\n}\n","sourceCodeStart":49,"sourceCodeEnd":73,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/compose-devservices/src/main/java/io/quarkus/it/compose/devservices/kafka/KafkaAdminManager.java#L49-L73","documentation":"Thrown by KafkaAdminManager.partitions after a describeTopics call returns no description for the requested topic. The admin client succeeded (no execution error) but Kafka reports the topic as absent, so the manager rejects the lookup with IllegalArgumentException.","triggerScenarios":"Calling partitions(topic) where the topic name is misspelled, the topic was deleted, or the Kafka broker (often started via compose/Dev Services) has not yet created/auto-created the topic.","commonSituations":"Dev Services Kafka started from docker-compose with auto-create disabled; race where the producer has not yet created the topic; connecting to the wrong broker/cluster than the one holding the topic; compose service not exposing the expected port.","solutions":["Verify the topic name matches exactly (case-sensitive) what exists: kafka-topics --bootstrap-server ... --list.","Enable auto-topic creation or create the topic explicitly before calling partitions().","Check that the app/Dev Services connect to the same broker as the compose service (correct bootstrap servers / port mapping)."],"exampleFix":"// before\nint p = manager.partitions(\"mytopic\"); // topic never created\n// after\nadmin.createTopics(List.of(new NewTopic(\"mytopic\", 1, (short) 1))).all().get();\nint p = manager.partitions(\"mytopic\");","handlingStrategy":"retry","validationCode":"Set<String> topics = admin.listTopics().names().get(5, TimeUnit.SECONDS);\nif (!topics.contains(topic)) {\n    admin.createTopics(List.of(new NewTopic(topic, 1, (short) 1))).all().get();\n}","typeGuard":"boolean topicExists(KafkaAdmin admin, String name) throws Exception {\n    return admin.listTopics().names().get(5, TimeUnit.SECONDS).contains(name);\n}","tryCatchPattern":"try {\n    int partitions = manager.partitions(topic);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Topic missing, creating it and retrying: \" + topic);\n    createTopicAndWait(topic);\n}","preventionTips":["Create topics explicitly before consuming their metadata.","Enable auto.create.topics.enable in dev brokers.","Wait for Kafka container readiness before tests touch topics.","Confirm bootstrap servers point at the same broker that holds the topic."],"tags":["kafka","devservices","topic-not-found"],"backgroundTag":"kafka-topic-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}