SigNoz/signoz · error

error while executing metric name query: %s

Error message

error while executing metric name query: %s

What it means

GetMetricName from the ClickHouse reader: the SELECT against time_series metric names (filtered by a %searchText% LIKE pattern) failed to run. The raw ClickHouse error is appended (%s), so the message carries the actual driver error text — read it to distinguish missing table, bad connection, or syntax problems.

Source

Thrown at pkg/query-service/app/clickhouseReader/reader.go:2986

			 )`,
			signozMetricDBName, signozTSTableNameV41Day,
			signozMetricDBName, signozTSTableNameV4Reduced)
	} else {
		query = fmt.Sprintf(
			`SELECT DISTINCT metric_name
			 FROM %s.%s
			 WHERE metric_name ILIKE $1`,
			signozMetricDBName, signozTSTableNameV41Day)
	}

	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 querying metric names", errorsV2.Attr(err))
		return nil, fmt.Errorf("error while executing metric name query: %s", err.Error())
	}
	defer rows.Close()

	var metricNames []string
	for rows.Next() {
		var name string
		if err := rows.Scan(&name); err != nil {
			return nil, fmt.Errorf("error while scanning metric name: %s", err.Error())
		}
		if skipSignozMetrics && strings.HasPrefix(name, "signoz") {
			continue
		}
		metricNames = append(metricNames, name)
	}

	if len(metricNames) == 0 {
		return &response, nil
	}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Read the %s portion — it contains the real ClickHouse error
  2. If 'table doesn't exist', ingest some metrics or run migrations to create signoz_metrics tables
  3. Verify ClickHouse connectivity from query-service (ping the datasource URL)
  4. Escape or clamp SearchText if users can inject % or _ into the LIKE pattern
Defensive patterns

Strategy: retry

Validate before calling

// ensure metrics exist before listing: SELECT count() FROM signoz_metrics.time_series

Try / catch

if err != nil {
  if strings.Contains(err.Error(), "Code: 60") { // UNKNOWN_TABLE
    return []string{}, nil // no metrics yet — not an error for the user
  }
  return nil, err
}

Prevention

When it happens

Trigger: Calling ListMetricKeyValues / metrics autocomplete APIs with a SearchText while the time_series table doesn't exist (no metrics ingested yet), ClickHouse is unreachable, or the query builder produced invalid SQL for exotic search strings.

Common situations: Fresh SigNoz installs with zero metrics yet; signoz_metrics schema not migrated; CLICKHOUSE_DATASOURCE misconfigured; upgrade that renamed the time_series table.

Related errors


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