{"record":{"id":"3987764a721abd35","repo":"SigNoz/signoz","slug":"prom-query-s-is-invalid-w","errorCode":null,"errorMessage":"prom query %s is invalid: %w","messagePattern":"prom query (.+?) is invalid: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":636,"sourceCode":"\t\tfor name, query := range c.BuilderQueries {\n\t\t\tif err := query.Validate(c.PanelType); err != nil {\n\t\t\t\treturn fmt.Errorf(\"builder query %s is invalid: %w\", name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif c.QueryType == QueryTypeClickHouseSQL {\n\t\tfor name, query := range c.ClickHouseQueries {\n\t\t\tif err := query.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"clickhouse query %s is invalid: %w\", name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif c.QueryType == QueryTypePromQL {\n\t\tfor name, query := range c.PromQueries {\n\t\t\tif err := query.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"prom query %s is invalid: %w\", name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := c.PanelType.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"panel type is invalid: %w\", err)\n\t}\n\n\tif err := c.QueryType.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"query type is invalid: %w\", err)\n\t}\n\n\treturn nil\n}\n\ntype Temporality string\n\nconst (","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L618-L654","documentation":"Thrown by CompositeQuery.Validate when a PromQueries entry fails PromQuery.Validate. The %s is the query name key; %w wraps the inner error such as a missing PromQL expression.","triggerScenarios":"Submitting queryType=promql with a PromQueries entry whose query/expression is empty or otherwise invalid.","commonSituations":"PromQL panels migrated from Prometheus, or programmatically generated payloads where the expression field was never populated.","solutions":["Check the wrapped error for the exact missing field","Ensure each PromQueries entry has a non-empty query string","Use the /api/v1/query API of the query service to smoke-test the payload before saving the dashboard"],"exampleFix":"// before\n{\"queryType\":\"promql\",\"promQueries\":{\"A\":{}}}\n// after\n{\"queryType\":\"promql\",\"promQueries\":{\"A\":{\"query\":\"up\"}}}","handlingStrategy":"validation","validationCode":"for name, q := range composite.PromQueries {\n\tif strings.TrimSpace(q.Query) == \"\" { return fmt.Errorf(\"prom query %s: empty query\", name) }\n}","typeGuard":"func hasPromQuery(q v3.PromQuery) bool { return strings.TrimSpace(q.Query) != \"\" }","tryCatchPattern":"if err := composite.Validate(); err != nil { return apiError(400, err) }","preventionTips":["Default the PromQL expression field in UI/API clients"],"tags":["go","promql","query-validation"],"backgroundTag":"query-payload-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}