SigNoz/signoz · error

errors.CodeInternal

errors.CodeInternal

Error message

ErrFailedToGetMeterKeys.Error()

What it means

Returned by getMeterSourceMetricKeys when rows.Err() reports a failure after iterating the ClickHouse result set for meter metric keys. This indicates the row iteration itself failed mid-stream (network interruption, result set aborted, decode error) rather than a bad query or bad row. Wrapped as internal with errors.CodeInternal.

Source

Thrown at pkg/telemetrymetadata/metadata.go:1101

		rowCount++
		// reached the limit, we know there are more results
		if rowCount > limit {
			break
		}

		var name string
		err = rows.Scan(&name)
		if err != nil {
			return nil, false, errors.Wrap(err, errors.TypeInternal, errors.CodeInternal, ErrFailedToGetMeterKeys.Error())
		}
		keys = append(keys, &telemetrytypes.TelemetryFieldKey{
			Name:   name,
			Signal: telemetrytypes.SignalMetrics,
		})
	}

	if rows.Err() != nil {
		return nil, false, errors.Wrap(rows.Err(), errors.TypeInternal, errors.CodeInternal, ErrFailedToGetMeterKeys.Error())
	}

	// hit the limit?
	complete := rowCount <= limit

	return keys, complete, nil

}

// applyBackwardCompatibleKeys adds backward compatible key aliases to the map.
func applyBackwardCompatibleKeys(mapOfKeys map[string][]*telemetrytypes.TelemetryFieldKey) {
	// Get backward compatible keys for all signals
	backwardCompatKeysBySignal := map[telemetrytypes.Signal]BackwardCompatibleKeyMap{
		telemetrytypes.SignalTraces:  GetBackwardCompatKeysForSignal(telemetrytypes.SignalTraces),
		telemetrytypes.SignalLogs:    GetBackwardCompatKeysForSignal(telemetrytypes.SignalLogs),
		telemetrytypes.SignalMetrics: GetBackwardCompatKeysForSignal(telemetrytypes.SignalMetrics),
	}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Check ClickHouse server logs for the corresponding query failure (timeouts, kills)
  2. Increase ClickHouse read/socket timeouts or reduce the requested limit
  3. Retry the call: transient stream errors often succeed on a second attempt
  4. Verify network stability between the app and ClickHouse
Defensive patterns

Strategy: retry

Try / catch

var keys []*telemetrytypes.TelemetryFieldKey
err := retry.Do(func() error {
	var err error
	keys, _, err = store.GetKeys(ctx, q)
	return err
}, retry.Attempts(3), retry.IsRetryable(isTransientClickHouseErr))

Prevention

When it happens

Trigger: Calling GetKeys/GetKeysMulti for metrics where the ClickHouse connection drops or the result stream errors during iteration of meter key rows, e.g. socket timeout, context cancellation, or server-side query kill.

Common situations: Large key cardinality causing long streaming reads that exceed idle/socket timeouts, ClickHouse server restarts mid-query, load balancer closing idle connections, or a cancelled request context.

Related errors


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