SigNoz/signoz · error
error while fetching logs schema: %s
Error message
error while fetching logs schema: %s
What it means
Error running SHOW CREATE TABLE against the logs local table while building the attribute-key response; the response uses the DDL to decide whether a tag is a real column (isColumn). Failing here aborts the whole attribute-keys result even though the key rows were fetched.
Source
Thrown at pkg/query-service/app/clickhouseReader/reader.go:3504
v3.AggregateOperatorNoOp:
return &v3.AggregateAttributeResponse{}, nil
default:
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 != 'logfield' limit $2", r.logsDB, r.logsTagAttributeTableV2, where)
rows, err = r.db.Query(ctx, query, fmt.Sprintf("%%%s%%", req.SearchText), req.Limit)
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.logsDB, r.logsLocalTableName)
err = r.db.Select(ctx, &statements, query)
if err != nil {
return nil, fmt.Errorf("error while fetching logs schema: %s", err.Error())
}
var tagKey string
var dataType string
var attType string
for rows.Next() {
if err := rows.Scan(&tagKey, &attType, &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(attType),
IsColumn: isColumn(statements[0].Statement, attType, tagKey, dataType),
}
response.AttributeKeys = append(response.AttributeKeys, key)
}
// add other attributesView on GitHub (pinned to 5069bf80b0)
Solutions
- Verify the table exists: SHOW CREATE TABLE <logsDB>.<logsLocalTableName>
- Fix logsDB/logsLocalTableName in query-service config
- Grant the ClickHouse user sufficient read privileges
- Align query-service version with deployed schema
Defensive patterns
Strategy: validation
Validate before calling
// Precheck DDL access
if _, err := db.Exec(ctx, fmt.Sprintf("SHOW CREATE TABLE %s.%s", logsDB, localTable)); err != nil {
return fmt.Errorf("logs table inaccessible: %w", err)
} Try / catch
if err != nil {
// fall back to returning keys without isColumn info
return keysWithUnknownColumnFlag(rows)
} Prevention
- Keep logsLocalTableName config accurate
- Grant SHOW privileges to the query-service DB user
When it happens
Trigger: logsLocalTableName or logsDB pointing at a non-existent table; ClickHouse user lacking SHOW/SELECT privilege on system tables; table renamed during upgrade.
Common situations: Config drift after renaming logs database/tables; version mismatch where query-service expects distributed_logs but deployment has different name; restricted ClickHouse user permissions.
Related errors
- removing a selected field is not allowed, please reach out t
- error while fetching trace schema: %s
- CodeLicenseUnavailable
- CodeForbidden
- CodeNotFound
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/5bef8eedf49fd957.
Report an issue: GitHub.