{"record":{"id":"4ab041a1aaaa0e77","repo":"quickwit-oss/quickwit","slug":"topic-has-no-partitions","errorCode":null,"errorMessage":"topic `{}` has no partitions","messagePattern":"topic `(.+?)` has no partitions","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-indexing/src/source/kafka_source.rs","lineNumber":649,"sourceCode":"        .create()?;\n\n    let topic = params.topic.clone();\n    let timeout = Timeout::After(Duration::from_secs(5));\n    let cluster_metadata = spawn_blocking(move || {\n        consumer\n            .fetch_metadata(Some(&topic), timeout)\n            .with_context(|| format!(\"failed to fetch metadata for topic `{topic}`\"))\n    })\n    .await??;\n\n    if cluster_metadata.topics().is_empty() {\n        bail!(\"topic `{}` does not exist\", params.topic);\n    }\n    let topic_metadata = &cluster_metadata.topics()[0];\n    assert_eq!(topic_metadata.name(), params.topic); // Belt and suspenders.\n\n    if topic_metadata.partitions().is_empty() {\n        bail!(\"topic `{}` has no partitions\", params.topic);\n    }\n    Ok(())\n}\n\n/// Creates a new `KafkaSourceConsumer`.\nfn create_consumer(\n    index_uid: &IndexUid,\n    source_id: &str,\n    params: KafkaSourceParams,\n    events_tx: mpsc::Sender<KafkaEvent>,\n) -> anyhow::Result<(ClientConfig, RdKafkaConsumer, GroupId)> {\n    // Group ID is limited to 255 characters.\n    let mut group_id = match &params.client_params[\"group.id\"] {\n        JsonValue::String(group_id) => group_id.clone(),\n        _ => format!(\"quickwit-{index_uid}-{source_id}\"),\n    };\n    group_id.truncate(255);\n","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-indexing/src/source/kafka_source.rs#L631-L667","documentation":"During Kafka source connectivity checks, the topic exists in the cluster metadata but reports zero partitions. With no partitions there is nothing to consume, which usually indicates a miscreated or misconfigured topic, so the source refuses to start.","triggerScenarios":"`check_connectivity` inspects `topic_metadata.partitions()` after fetching topic metadata; the list is empty, triggering the bail.","commonSituations":"Topic in a transient/deleting state; brokers returning inconsistent metadata; a misconfigured or broken cluster reporting a partitionless topic.","solutions":["Recreate or reconfigure the Kafka topic with at least one partition","Verify you connected to the intended Kafka cluster and typed the topic name correctly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"kafka-metadata --bootstrap-server $BROKERS --topic $TOPIC | jq -e '.partitions | length > 0'","typeGuard":null,"tryCatchPattern":"// retry connectivity check; transient metadata states often resolve\nfor _ in 0..3 {\n    if check_connectivity(...).await.is_ok() { break; }\n    tokio::time::sleep(Duration::from_secs(5)).await;\n}","preventionTips":["Recreate topics with at least one partition.","Check broker health if topics report zero partitions.","Avoid configuring sources for topics mid-deletion."],"tags":["kafka","topic-partitions","connectivity-check","rust"],"backgroundTag":"resource-not-found","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}