SigNoz/signoz · error · model.ApiError
couldn't query attrib values for suggestions: %w
Error message
couldn't query attrib values for suggestions: %w
What it means
InternalError from getValuesForLogAttributes when the UNION DISTINCT tag-value query against ClickHouse fails while building log filter suggestions. The query is built per requested attribute and executed with max_threads=2; any DB-level failure (timeout, missing column, overload) triggers it.
Source
Thrown at pkg/query-service/app/clickhouseReader/filter_suggestions.go:188
select tag_key, string_value, number_value
from %s.%s
where tag_key = $%d and (
string_value != '' or number_value is not null
) and tag_type != 'logfield'
limit %d
)`, r.logsDB, r.logsTagAttributeTableV2, idx+1, limit))
tagKeyQueryArgs = append(tagKeyQueryArgs, attrib.Key)
}
query := fmt.Sprintf(`select * from (
%s
) settings max_threads=2`, strings.Join(tagQueries, " UNION DISTINCT "))
rows, err := r.db.Query(ctx, query, tagKeyQueryArgs...)
if err != nil {
r.logger.ErrorContext(ctx, "couldn't query attrib values for suggestions", errorsV2.Attr(err))
return nil, model.InternalError(fmt.Errorf(
"couldn't query attrib values for suggestions: %w", err,
))
}
defer rows.Close()
result := make([][]any, len(attributes))
// Helper for getting hold of the result slice to append to for each scanned row
resultIdxForAttrib := func(key string, dataType v3.AttributeKeyDataType) int {
return slices.IndexFunc(attributes, func(attrib v3.AttributeKey) bool {
return attrib.Key == key && attrib.DataType == dataType
})
}
// Scan rows and append to result
for rows.Next() {
var tagKey string
var stringValue stringView on GitHub (pinned to 5069bf80b0)
Solutions
- Check server logs for the logged ClickHouse error (it is logged just before returning)
- Validate the requested attribute keys actually exist as columns in the log tables
- Reduce the number/range of attributes requested or add time bounds
- Scale/optimize ClickHouse (marks, memory limits) or retry when load drops
Defensive patterns
Strategy: retry
Validate before calling
// Validate requested attributes exist before asking for values
for _, k := range req.AttributeKeys {
if !attributeKeyExists(ctx, ch, k) { return fmt.Errorf("unknown attribute %s", k) }
} Type guard
func isChQueryErr(err error) bool {
var apiErr *model.ApiError
return errors.As(err, &apiErr) && apiErr.Typ == model.ErrorInternal && strings.Contains(err.Error(), "attrib values")
} Try / catch
vals, err := reader.GetQBFilterSuggestionsForLogs(ctx, req)
if err != nil && isChQueryErr(err) {
// transient CH failures are common; retry once with smaller attribute set
req.AttributeKeys = req.AttributeKeys[:1]
vals, err = reader.GetQBFilterSuggestionsForLogs(ctx, req)
} Prevention
- Limit attributes per suggestions request
- Add time-range bounds to value queries
- Monitor ClickHouse query latencies/kill counts
When it happens
Trigger: GetQBFilterSuggestionsForLogs with one or more string/number attributes whose UNION-ed SELECT against the tag value tables fails: unknown column (renamed/missing attribute key), ClickHouse timeout, or packet/protocol errors under load.
Common situations: Attribute keys that no longer exist in the schema, mixed schema versions after upgrade, ClickHouse under memory pressure, very high-cardinality attributes making the UNION DISTINCT query slow/aborted.
Related errors
- couldn't get attribute keys: %w
- removing a selected field is not allowed, please reach out t
- couldn't scan attrib value rows: %w
- error in processing sql query
- error in processing sql query %w
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/1463853c7d1691cb.
Report an issue: GitHub.