SigNoz/signoz · error · model.ApiError
couldn't get attribute keys: %w
Error message
couldn't get attribute keys: %w
What it means
Returned by GetQBFilterSuggestionsForLogs when the underlying call to fetch log attribute keys (GetAttributeKeys against the logs data source, e.g. signoz_logs.distributed_log_attribute_keys) fails. It is an InternalError wrapping the ClickHouse query failure, so the root cause is in the wrapped %w error.
Source
Thrown at pkg/query-service/app/clickhouseReader/filter_suggestions.go:34
func (r *ClickHouseReader) GetQBFilterSuggestionsForLogs(
ctx context.Context,
req *v3.QBFilterSuggestionsRequest,
) (*v3.QBFilterSuggestionsResponse, *model.ApiError) {
suggestions := v3.QBFilterSuggestionsResponse{
AttributeKeys: []v3.AttributeKey{},
ExampleQueries: []v3.FilterSet{},
}
// Use existing autocomplete logic for generating attribute suggestions
attribKeysResp, err := r.GetLogAttributeKeys(
ctx, &v3.FilterAttributeKeyRequest{
SearchText: req.SearchText,
DataSource: v3.DataSourceLogs,
Limit: int(req.AttributesLimit),
})
if err != nil {
return nil, model.InternalError(fmt.Errorf("couldn't get attribute keys: %w", err))
}
suggestions.AttributeKeys = attribKeysResp.AttributeKeys
// Rank suggested attributes
attribRanker.sort(suggestions.AttributeKeys)
// Put together suggested example queries.
newExampleQuery := func() v3.FilterSet {
// Include existing filter in example query if specified.
if req.ExistingFilter != nil {
return *req.ExistingFilter
}
return v3.FilterSet{
Operator: "AND",
Items: []v3.FilterItem{},View on GitHub (pinned to 5069bf80b0)
Solutions
- Inspect the wrapped error and server logs for the real ClickHouse failure
- Verify ClickHouse connectivity and that the logs schema (distributed_log_attribute_keys etc.) exists
- Run/complete ClickHouse migrations if tables are missing
- Increase ClickHouse memory/thread settings or reduce AttributesLimit if the query is being killed
- Retry once ClickHouse is healthy
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: verify CH reachability and attribute-keys table exists
if err := pingClickhouse(chAddr); err != nil { return err }
if !tableExists(ctx, ch, "signoz_logs", "distributed_log_attribute_keys") {
return fmt.Errorf("logs schema missing; run migrations")
} Type guard
func isInternalApiErr(err error) bool {
var apiErr *model.ApiError
return errors.As(err, &apiErr) && apiErr.Typ == model.ErrorInternal
} Try / catch
suggestions, err := api.GetQBFilterSuggestionsForLogs(ctx, req)
if err != nil {
logAttrs("attr-keys failed", err) // wrapped %w carries CH cause
return degradeGracefully(ctx) // e.g. empty suggestions + 5xx
} Prevention
- Health-check ClickHouse before serving suggestion endpoints
- Keep SigNoz migrations complete before enabling the QB
- Bound AttributesLimit to keep key lookups cheap
When it happens
Trigger: Calling the query-builder filter-suggestions API for logs while ClickHouse is unreachable, the attribute-keys table doesn't exist (cold cluster / migrations not run), or the query times out or is killed for resource limits.
Common situations: Fresh SigNoz install where ClickHouse schema/migrations haven't completed, wrong CH connection settings (CLICKHOUSE_URL misconfigured), ClickHouse overload or memory limits aborting the query, or version mismatch where the attribute keys table was renamed.
Related errors
- couldn't query attrib values for suggestions: %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/ae881dbf8fb7c781.
Report an issue: GitHub.