{"record":{"id":"1615b13b0105ee95","repo":"SigNoz/signoz","slug":"query-is-empty","errorCode":null,"errorMessage":"query is empty","messagePattern":"query is empty","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":484,"sourceCode":"func (p *PromQuery) Clone() *PromQuery {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn &PromQuery{\n\t\tQuery:    p.Query,\n\t\tStats:    p.Stats,\n\t\tDisabled: p.Disabled,\n\t\tLegend:   p.Legend,\n\t}\n}\n\nfunc (p *PromQuery) Validate() error {\n\tif p == nil {\n\t\treturn nil\n\t}\n\n\tif p.Query == \"\" {\n\t\treturn fmt.Errorf(\"query is empty\")\n\t}\n\n\treturn nil\n}\n\ntype ClickHouseQuery struct {\n\tQuery    string `json:\"query\"`\n\tDisabled bool   `json:\"disabled\"`\n\tLegend   string `json:\"legend,omitempty\"`\n}\n\nfunc (c *ClickHouseQuery) Clone() *ClickHouseQuery {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn &ClickHouseQuery{\n\t\tQuery:    c.Query,\n\t\tDisabled: c.Disabled,","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L466-L502","documentation":"PromQuery.Validate() requires a non-empty Query string when a PromQueries entry is present in a composite query. It is invoked from CompositeQuery.Validate() when queryType is promql (or when prom queries are present).","triggerScenarios":"Submitting queryType \"promql\" with a promQueries map whose entry has an empty or missing query field, or sending blank query strings from an editor panel that hasn't been filled in.","commonSituations":"Dashboards created with an empty PromQL editor state, templating that renders to an empty string, or clients copying the composite-query skeleton and forgetting to populate each named query.","solutions":["Set a real PromQL expression, e.g. query: \"up\" or \"rate(http_requests_total[5m])\"","Skip adding the promQueries entry entirely if there's no expression","Guard the UI so empty editor panels aren't serialized into the request"],"exampleFix":"// before\n\"promQueries\":{\"A\":{\"query\":\"\"}}\n\n// after\n\"promQueries\":{\"A\":{\"query\":\"up\"}}","handlingStrategy":"validation","validationCode":"if cq.PromQueries != nil { for name, q := range cq.PromQueries { if q != nil && q.Query == \"\" { return fmt.Errorf(\"prom query %s is empty\", name) } } }","typeGuard":"func promQueriesComplete(cq *v3.CompositeQuery) bool { for _, q := range cq.PromQueries { if q == nil || q.Query == \"\" { return false } }; return true }","tryCatchPattern":null,"preventionTips":["Don't serialize empty editor panels","Skip adding a promQueries entry when there is no expression"],"tags":["go","validation","missing-field","promql","signoz"],"backgroundTag":"missing-required-field","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}