{"record":{"id":"90b48d8ee0c9c6da","repo":"SigNoz/signoz","slug":"invalid-type-for-service","errorCode":null,"errorMessage":"invalid type for service","messagePattern":"invalid type for service","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/integrations/messagingQueues/kafka/translator.go","lineNumber":374,"sourceCode":"\tvar query string\n\n\tswitch queryContext {\n\tcase \"producer\":\n\t\tquery = generateProducerSQL(start, end, topic, partition, queueType)\n\tcase \"consumer\":\n\t\tconsumerGroup, ok := messagingQueue.Variables[\"consumer_group\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid type for consumer group\")\n\t\t}\n\t\tquery = generateConsumerSQL(start, end, topic, partition, consumerGroup, queueType)\n\tcase \"producer-topic-throughput\":\n\t\tquery = generatePartitionLatencySQL(start, end, queueType)\n\tcase \"consumer_partition_latency\":\n\t\tquery = generateConsumerPartitionLatencySQL(start, end, topic, partition, queueType)\n\tcase \"producer-throughput-details\":\n\t\tsvcName, ok := messagingQueue.Variables[\"service_name\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid type for service\")\n\t\t}\n\t\tquery = generateProducerTopicLatencySQL(start, end, topic, svcName, queueType)\n\tcase \"consumer-throughput-overview\":\n\t\tquery = generateConsumerLatencySQL(start, end, queueType)\n\tcase \"consumer-throughput-details\":\n\t\tsvcName, ok := messagingQueue.Variables[\"service_name\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid type for service\")\n\t\t}\n\t\tquery = generateConsumerServiceLatencySQL(start, end, topic, svcName, queueType)\n\tcase \"producer-consumer-eval\":\n\t\tquery = generateProducerConsumerEvalSQL(start, end, queueType, messagingQueue.EvalTime)\n\tcase \"onboard_producers\":\n\t\tquery = onboardProducersSQL(start, end, queueType)\n\tcase \"onboard_consumers\":\n\t\tquery = onboardConsumerSQL(start, end, queueType)\n\t}\n","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/integrations/messagingQueues/kafka/translator.go#L356-L392","documentation":"Returned by BuildClickHouseQuery when queryContext is \"producer-throughput-details\" and the optional variable \"service_name\" is not present in messagingQueue.Variables. The producer throughput detail SQL needs a service name to partition the query by producer service. Without it the builder refuses to guess and returns this error.","triggerScenarios":"Calling BuildClickHouseQuery with queryContext == \"producer-throughput-details\" and a Variables map without \"service_name\". Reached through onboardProducers, onboardConsumers, or BuildQueryRangeParams.","commonSituations":"A Kafka producer details panel whose service filter variable was cleared or never set; automated dashboards provisioned from YAML that omit the service_name variable; variable key renamed between versions (e.g. service to service_name).","solutions":["Set mq.Variables[\"service_name\"] to the producer service name before calling BuildClickHouseQuery.","Verify the dashboard variable binding for producer detail widgets still maps to the key \"service_name\".","Add a pre-call check that service_name exists for producer-throughput-details contexts and surface a descriptive validation error.","Regenerate/re-save the dashboard after upgrading so variable defaults are populated."],"exampleFix":"// before\nquery, err := BuildClickHouseQuery(ctx, mq, \"producer-throughput-details\") // Variables lacks service_name\n\n// after\nmq.Variables[\"service_name\"] = \"checkout-service\"\nquery, err := BuildClickHouseQuery(ctx, mq, \"producer-throughput-details\")","handlingStrategy":"validation","validationCode":"if queryContext == \"producer-throughput-details\" {\n\tif _, ok := mq.Variables[\"service_name\"]; !ok {\n\t\treturn fmt.Errorf(\"service_name variable required for producer throughput details\")\n\t}\n}","typeGuard":"func isProducerDetailsReady(mq *messagingqueues.MetricQueryRangeParams) bool {\n\t_, ok := mq.Variables[\"service_name\"]\n\treturn ok\n}","tryCatchPattern":null,"preventionTips":["Validate service_name presence for *-throughput-details contexts before the call.","Keep dashboard variable keys in sync with the backend contract via a shared constants file."],"tags":["kafka","clickhouse","query-builder","missing-variable","messaging-queues"],"backgroundTag":"missing-required-parameter","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}