SigNoz/signoz · warning
invalid type for Topic
Error message
invalid type for Topic
What it means
Error returned by BuildClickHouseQuery when the 'topic' variable is missing while building throughput/latency detail queries that require it. The message 'invalid type for Topic' is misleading — it actually means the key is absent from the variables map.
Source
Thrown at pkg/query-service/app/integrations/messagingQueues/kafka/translator.go:343
queueType string,
queryContext string,
) (*v3.ClickHouseQuery, error) {
start := messagingQueue.Start
end := messagingQueue.End
var topic, partition string
if queryContext == "producer" ||
queryContext == "consumer" ||
queryContext == "consumer_partition_latency" ||
queryContext == "producer-throughput-details" ||
queryContext == "consumer-throughput-details" {
var ok bool
topic, ok = messagingQueue.Variables["topic"]
if !ok {
return nil, fmt.Errorf("invalid type for Topic")
}
if !(queryContext == "consumer-throughput-details" ||
queryContext == "producer-throughput-details") {
partition, ok = messagingQueue.Variables["partition"]
if !ok {
return nil, fmt.Errorf("invalid type for Partition")
}
}
}
var query string
switch queryContext {
case "producer":
query = generateProducerSQL(start, end, topic, partition, queueType)
case "consumer":View on GitHub (pinned to 5069bf80b0)
Solutions
- Add the topic variable to the request
- Set a non-empty default topic in the dashboard's template variable
- Validate required variables per query context before calling
Example fix
// before
Variables: map[string]string{}
// after
Variables: map[string]string{"topic": "orders", "partition": "0"} Defensive patterns
Strategy: validation
Validate before calling
const required = ['topic','partition'];
for (const k of required) if (!(k in mq.Variables)) throw new Error(`${k} required`); Type guard
func hasRequiredVars(v map[string]string, keys ...string) bool { for _, k := range keys { if _, ok := v[k]; !ok { return false } }; return true } Prevention
- Set topic template variable defaults
- Understand which contexts require which variables
When it happens
Trigger: Calling Kafka overview/detail query contexts (e.g. producer-throughput-overview, consumer-latency-overview) without a topic in messagingQueue.Variables.
Common situations: Dashboard variables for topic not set, or a client querying detail endpoints without topic selection.
Related errors
- consumer_group not found in the request
- partition not found in the request
- invalid type for Partition
- span evaluation feature is disabled and is experimental
- invalid type for consumer group
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/3a3f6d0921303715.
Report an issue: GitHub.