jaegertracing/jaeger · error

failed to get attribute metadata: %w

Error message

failed to get attribute metadata: %w

What it means

buildFindTraceIDsQuery wraps failures from getAttributeMetadata, which resolves which ClickHouse columns/tables hold each queried attribute. When fetching attribute metadata from the backend fails, the trace-ID search cannot build attribute conditions and this wrapped error is returned.

Source

Thrown at internal/storage/v2/clickhouse/tracestore/query_builder.go:166

		appendAnd(&inner, "s.duration >= ?")
		args = append(args, query.DurationMin.Nanoseconds())
	}
	if query.DurationMax > 0 {
		appendAnd(&inner, "s.duration <= ?")
		args = append(args, query.DurationMax.Nanoseconds())
	}
	if !query.StartTimeMin.IsZero() {
		appendAnd(&inner, "s.start_time >= ?")
		args = append(args, query.StartTimeMin)
	}
	if !query.StartTimeMax.IsZero() {
		appendAnd(&inner, "s.start_time <= ?")
		args = append(args, query.StartTimeMax)
	}

	attributeMetadata, err := r.getAttributeMetadata(ctx, query.Attributes)
	if err != nil {
		return "", nil, fmt.Errorf("failed to get attribute metadata: %w", err)
	}

	args, err = buildAttributeConditions(&inner, args, query.Attributes, attributeMetadata)
	if err != nil {
		return "", nil, err
	}

	inner.WriteString("\nLIMIT ?")
	args = append(args, limit)

	// Wrap the inner subquery with a JOIN to trace_id_timestamps
	// to retrieve start/end times only for the limited set of trace IDs.
	q := fmt.Sprintf(sql.SearchTraceIDs, indentBlock(inner.String()))

	return q, args, nil
}

func buildAttributeConditions(q *strings.Builder, args []any, attributes pcommon.Map, metadata attributeMetadata) ([]any, error) {

View on GitHub (pinned to 806f444784)

Solutions

  1. Check the wrapped inner error to identify the underlying ClickHouse failure
  2. Verify schema migrations ran and attribute metadata tables exist
  3. Confirm the database user has SELECT privileges on those tables
  4. Check connectivity to ClickHouse and retry transient failures

Example fix

// before: assuming tables exist
// after: ensure schema is provisioned
// run: jaeger storage init / apply ClickHouse migrations before starting
Defensive patterns

Strategy: retry

Validate before calling

// preflight: verify metadata tables exist
rows, err := ch.Query(ctx, "EXISTS TABLE default.attribute_metadata")
if err != nil || !exists(rows) { /* run migrations first */ }

Try / catch

traceIDs, err := store.FindTraceIDs(ctx, query)
if err != nil && strings.Contains(err.Error(), "failed to get attribute metadata") {
    if retryable(err) {
        return retry.WithBackoff(ctx, 3, func() error {
            _, err = store.FindTraceIDs(ctx, query)
            return err
        })
    }
    return fmt.Errorf("check ClickHouse schema/migrations: %w", err)
}

Prevention

When it happens

Trigger: FindTraceIDs is called with attribute filters while the underlying metadata lookup (typically a ClickHouse query against attribute-metadata tables) returns an error — e.g. missing table, connection failure, or permission error.

Common situations: Schema not initialized (migrations not run); ClickHouse credentials lacking SELECT on metadata tables; transient network partitions between the app and ClickHouse.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/5654bd2ff028b693. Report an issue: GitHub.