{"record":{"id":"368c8a424bd55c72","repo":"SigNoz/signoz","slug":"live-tail-is-only-supported-for-single-query","errorCode":null,"errorMessage":"live tail is only supported for single query","messagePattern":"live tail is only supported for single query","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/queryBuilder/query_builder.go","lineNumber":160,"sourceCode":"\t\tconditions := []string{}\n\t\tfor _, having := range qp.CompositeQuery.BuilderQueries[queryName].Having {\n\t\t\tconditions = append(conditions, fmt.Sprintf(\"%s %s %v\", \"value\", having.Operator, having.Value))\n\t\t}\n\t\thavingClause := \" HAVING \" + strings.Join(conditions, \" AND \")\n\t\tformulaQuery += havingClause\n\t}\n\treturn formulaQuery, nil\n}\n\nfunc (qb *QueryBuilder) PrepareLiveTailQuery(params *v3.QueryRangeParamsV3) (string, error) {\n\tvar queryStr string\n\tvar err error\n\tcompositeQuery := params.CompositeQuery\n\n\tif compositeQuery != nil {\n\t\t// There can only be a signle query and there is no concept of disabling queries\n\t\tif len(compositeQuery.BuilderQueries) != 1 {\n\t\t\treturn \"\", fmt.Errorf(\"live tail is only supported for single query\")\n\t\t}\n\t\tfor queryName, query := range compositeQuery.BuilderQueries {\n\t\t\tif query.Expression == queryName {\n\t\t\t\tqueryStr, err = qb.options.BuildLogQuery(params.Start, params.End, compositeQuery.QueryType, compositeQuery.PanelType, query, v3.QBOptions{IsLivetailQuery: true})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn queryStr, nil\n}\n\nfunc (qb *QueryBuilder) PrepareQueries(params *v3.QueryRangeParamsV3) (map[string]string, error) {\n\tqueries := make(map[string]string)\n\n\tcompositeQuery := params.CompositeQuery","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/queryBuilder/query_builder.go#L142-L178","documentation":"Thrown by PrepareLiveTailQuery in SigNoz's query builder when the composite query contains zero or more than one builder query. Live tail streams logs for exactly one query, so multiple queries (or none) in the composite query are rejected before query generation.","triggerScenarios":"Calling the live-tail query preparation endpoint with a compositeQuery whose BuilderQueries map has 0 entries or 2+ entries (e.g. multiple log queries, or a formula plus a query, or all queries disabled).","commonSituations":"Frontend sends the whole dashboard panel composite query to the live-tail API instead of a single query; user opens live tail on a panel with multiple queries or formulas; empty compositeQuery passed from a script.","solutions":["Ensure the composite query contains exactly one builder query before invoking live tail","On the client, pick or merge to a single query rather than sending the full panel compositeQuery","Check that no queries were disabled/removed leaving an empty BuilderQueries map"],"exampleFix":"// before\nparams.CompositeQuery = panel.CompositeQuery // may have 2+ queries\nqb.PrepareLiveTailQuery(params)\n\n// after\nif len(panel.CompositeQuery.BuilderQueries) != 1 {\n    return fmt.Errorf(\"live tail requires exactly one query\")\n}\nparams.CompositeQuery = panel.CompositeQuery\nqb.PrepareLiveTailQuery(params)","handlingStrategy":"validation","validationCode":"if params.CompositeQuery == nil || len(params.CompositeQuery.BuilderQueries) != 1 {\n    return errors.New(\"live tail requires exactly one builder query\")\n}\nresp, err := qb.PrepareLiveTailQuery(params)","typeGuard":"func isSingleBuilderQuery(cq *v3.CompositeQuery) bool {\n    return cq != nil && len(cq.BuilderQueries) == 1\n}","tryCatchPattern":null,"preventionTips":["Keep live-tail UI bound to a single selected query","Disable the live-tail button when the panel has 2+ queries or formulas"],"tags":["signoz","live-tail","logs","query-builder","validation"],"backgroundTag":"query-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}