SigNoz/signoz · error

live tail is only supported for single query

Error message

live tail is only supported for single query

What it means

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.

Source

Thrown at pkg/query-service/app/queryBuilder/query_builder.go:160

		conditions := []string{}
		for _, having := range qp.CompositeQuery.BuilderQueries[queryName].Having {
			conditions = append(conditions, fmt.Sprintf("%s %s %v", "value", having.Operator, having.Value))
		}
		havingClause := " HAVING " + strings.Join(conditions, " AND ")
		formulaQuery += havingClause
	}
	return formulaQuery, nil
}

func (qb *QueryBuilder) PrepareLiveTailQuery(params *v3.QueryRangeParamsV3) (string, error) {
	var queryStr string
	var err error
	compositeQuery := params.CompositeQuery

	if compositeQuery != nil {
		// There can only be a signle query and there is no concept of disabling queries
		if len(compositeQuery.BuilderQueries) != 1 {
			return "", fmt.Errorf("live tail is only supported for single query")
		}
		for queryName, query := range compositeQuery.BuilderQueries {
			if query.Expression == queryName {
				queryStr, err = qb.options.BuildLogQuery(params.Start, params.End, compositeQuery.QueryType, compositeQuery.PanelType, query, v3.QBOptions{IsLivetailQuery: true})
				if err != nil {
					return "", err
				}
			}
		}

	}
	return queryStr, nil
}

func (qb *QueryBuilder) PrepareQueries(params *v3.QueryRangeParamsV3) (map[string]string, error) {
	queries := make(map[string]string)

	compositeQuery := params.CompositeQuery

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Ensure the composite query contains exactly one builder query before invoking live tail
  2. On the client, pick or merge to a single query rather than sending the full panel compositeQuery
  3. Check that no queries were disabled/removed leaving an empty BuilderQueries map

Example fix

// before
params.CompositeQuery = panel.CompositeQuery // may have 2+ queries
qb.PrepareLiveTailQuery(params)

// after
if len(panel.CompositeQuery.BuilderQueries) != 1 {
    return fmt.Errorf("live tail requires exactly one query")
}
params.CompositeQuery = panel.CompositeQuery
qb.PrepareLiveTailQuery(params)
Defensive patterns

Strategy: validation

Validate before calling

if params.CompositeQuery == nil || len(params.CompositeQuery.BuilderQueries) != 1 {
    return errors.New("live tail requires exactly one builder query")
}
resp, err := qb.PrepareLiveTailQuery(params)

Type guard

func isSingleBuilderQuery(cq *v3.CompositeQuery) bool {
    return cq != nil && len(cq.BuilderQueries) == 1
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/368c8a424bd55c72. Report an issue: GitHub.