jaegertracing/jaeger · error

failed to scan row: %w

Error message

failed to scan row: %w

What it means

While iterating service rows, GetServices scans each row into a dbmodel.Service via rows.ScanStruct; if the scan fails (schema mismatch, NULL in a non-nullable field, wrong column types), the error is appended and iteration breaks. The wrapped error identifies the offending column and Go type.

Source

Thrown at internal/storage/v2/clickhouse/tracestore/reader.go:123

			}
		}
	}
}

func (r *Reader) GetServices(ctx context.Context) ([]string, error) {
	rows, err := r.conn.Query(ctx, sql.SelectServices)
	if err != nil {
		return nil, fmt.Errorf("failed to query services: %w", err)
	}

	var (
		services []string
		errs     []error
	)
	for rows.Next() {
		var service dbmodel.Service
		if scanErr := rows.ScanStruct(&service); scanErr != nil {
			errs = append(errs, fmt.Errorf("failed to scan row: %w", scanErr))
			break
		}
		services = append(services, service.Name)
	}
	if rowsErr := rows.Err(); rowsErr != nil {
		errs = append(errs, fmt.Errorf("failed to read service rows: %w", rowsErr))
	}
	if closeErr := rows.Close(); closeErr != nil {
		errs = append(errs, fmt.Errorf("failed to close rows: %w", closeErr))
	}
	if err := errors.Join(errs...); err != nil {
		return nil, err
	}
	return services, nil
}

func (r *Reader) GetOperations(
	ctx context.Context,

View on GitHub (pinned to 806f444784)

Solutions

  1. Run the schema migrations matching your jaeger version so the services table matches dbmodel.Service
  2. Check the wrapped error for the failing column and fix its type/nullability
  3. Clean or backfill rows containing NULLs where the struct expects values
  4. Re-create the services aggregation table if it was hand-modified

Example fix

// before
service_name Nullable(String) -- ScanStruct into string fails on NULL
// after
service_name String -- with NOT NULL, per jaeger schema
Defensive patterns

Strategy: try-catch

Validate before calling

// verify the services table schema matches expectations
cols, err := conn.Query(ctx, "DESCRIBE TABLE service_names")
// check service_name column is non-nullable String

Try / catch

services, err := reader.GetServices(ctx)
if err != nil {
	if strings.Contains(err.Error(), "failed to scan row") {
		log.Printf("service_names schema mismatch: %v", err) // fix schema, don't retry
	}
	return err
}

Prevention

When it happens

Trigger: Calling GetServices against a services/name table whose columns don't match dbmodel.Service's fields — e.g. after a schema rename, or a NULL service name in a table expecting non-null String.

Common situations: Version skew between jaeger code and the applied ClickHouse schema; manually altered tables; data imported from another backend with different nullability conventions.

Related errors


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