SigNoz/signoz · error
error while fetching trace schema: %s
Error message
error while fetching trace schema: %s
What it means
After successfully listing tag keys, the reader runs SHOW CREATE TABLE <tracesdb>.<traceLocalTableName> via db.Select into []model.ShowCreateTableStatement and that failed. The schema string is needed to compute the IsColumn flag for each attribute key, so the whole request fails.
Source
Thrown at pkg/query-service/app/clickhouseReader/reader.go:4241
return nil, fmt.Errorf("unsupported aggregate operator")
}
query = fmt.Sprintf("SELECT DISTINCT(tag_key), tag_type, tag_data_type FROM %s.%s WHERE %s and tag_type != 'spanfield'", r.TraceDB, r.spanAttributeTableV2, where)
if req.Limit != 0 {
query = query + fmt.Sprintf(" LIMIT %d;", req.Limit)
}
rows, err = r.db.Query(ctx, query, fmt.Sprintf("%%%s%%", req.SearchText))
if err != nil {
r.logger.Error("Error while executing query", errorsV2.Attr(err))
return nil, fmt.Errorf("error while executing query: %s", err.Error())
}
defer rows.Close()
statements := []model.ShowCreateTableStatement{}
query = fmt.Sprintf("SHOW CREATE TABLE %s.%s", r.TraceDB, r.traceLocalTableName)
err = r.db.Select(ctx, &statements, query)
if err != nil {
return nil, fmt.Errorf("error while fetching trace schema: %s", err.Error())
}
var tagKey string
var dataType string
var tagType string
for rows.Next() {
if err := rows.Scan(&tagKey, &tagType, &dataType); err != nil {
return nil, fmt.Errorf("error while scanning rows: %s", err.Error())
}
key := v3.AttributeKey{
Key: tagKey,
DataType: v3.AttributeKeyDataType(dataType),
Type: v3.AttributeKeyType(tagType),
IsColumn: isColumn(statements[0].Statement, tagType, tagKey, dataType),
}
if _, ok := constants.DeprecatedStaticFieldsTraces[tagKey]; !ok {
response.AttributeKeys = append(response.AttributeKeys, key)View on GitHub (pinned to 5069bf80b0)
Solutions
- Run SHOW CREATE TABLE <tracesdb>.<traceLocalTableName> manually as the query-service ClickHouse user to reproduce the exact error
- Check the env/config value for the local trace table name and align it with the actual local table (SHOW TABLES FROM <tracesdb>)
- Grant the ClickHouse user SHOW/SELECT privileges if the error is permission related
- Update SigNoz so table naming matches the current schema migrations
Defensive patterns
Strategy: try-catch
Validate before calling
// startup check: verify the local trace table is visible
rows, err := ch.Query(ctx, "SHOW TABLES FROM "+traceDB+" LIKE '"+localTable+"'")
if err != nil || !rows.Next() {
log.Fatal("local trace table not found; check CH_LOCAL_EVENT_TABLE config")
} Try / catch
if err != nil {
if strings.Contains(err.Error(), "error while fetching trace schema") {
// schema lookup failed: check table existence/permissions, return 503 not 400
}
} Prevention
- Validate traceLocalTableName config at service startup
- Grant the ClickHouse user SHOW and SELECT on the traces database
- Add a startup readiness probe that runs SHOW CREATE TABLE on required tables
When it happens
Trigger: Calling GetAggregateAttribute on a distributed SigNoz setup where the local table (e.g. distributed_signoz_trace_spans / signoz_trace_spans_local) named by r.traceLocalTableName does not exist on the node being queried; insufficient permissions for SHOW CREATE TABLE; ClickHouse restarted mid-request dropping the connection.
Common situations: Config variable CH_LOCAL_EVENT_TABLE / traceLocalTableName set to a wrong name; a migration renamed the local table; user account lacks SHOW grant; older cluster where only the Distributed table exists with a different local name.
Related errors
- error while fetching logs schema: %s
- CodeLicenseUnavailable
- CodeForbidden
- CodeNotFound
- ErrCodeInvalidState
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/24f54d0e70ca486c.
Report an issue: GitHub.