jaegertracing/jaeger · error
failed to Exec query '%s': %w
Error message
failed to Exec query '%s': %w
What it means
Table.Exec wraps a failed Cassandra CQL write (query.Exec()) with the query text and the underlying driver error. It exists so callers get metrics emitted plus a single error that names exactly which statement failed. The %w wrapping preserves the original driver error for errors.Is/As inspection.
Source
Thrown at internal/storage/cassandra/metrics/table.go:40
// NewTable takes a metrics scope and creates a table metrics struct
func NewTable(factory metrics.Factory, tableName string) *Table {
t := spanstoremetrics.WriteMetrics{}
metrics.Init(&t, factory.Namespace(metrics.NSOptions{Name: "", Tags: map[string]string{"table": tableName}}), nil)
return &Table{t}
}
// Exec executes an update query and reports metrics/logs about it.
func (t *Table) Exec(query cassandra.UpdateQuery, logger *zap.Logger) error {
start := time.Now()
err := query.Exec()
t.Emit(err, time.Since(start))
if err != nil {
queryString := query.String()
if logger != nil {
logger.Error("Failed to exec query", zap.String("query", queryString), zap.Error(err))
}
return fmt.Errorf("failed to Exec query '%s': %w", queryString, err)
}
return nil
}
View on GitHub (pinned to 806f444784)
Solutions
- Read the wrapped driver error after 'failed to Exec query ...' to get the root cause (use %v of the full chain or errors.Unwrap).
- Verify Cassandra connectivity and that the target keyspace/table exist (run jaeger's init/schema job).
- Check the logged 'Failed to exec query' zap entry for the exact CQL statement and fix the statement or data.
- Inspect Cassandra server logs / nodetool status for cluster health if errors are transient.
- Upgrade driver/retry policies if timeouts occur under load; add retries with backoff around Exec.
Example fix
// before
err := table.Exec(query, logger)
if err != nil {
return err // opaque
}
// after
err := table.Exec(query, logger)
if err != nil {
var cerr *gocql.Error
if errors.As(err, &cerr) {
logger.Warn("cassandra write failed", zap.Int32("code", cerr.Code), zap.Error(cerr))
}
return fmt.Errorf("writing spans: %w", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
// precondition: verify Cassandra is reachable before writes
if err := session.Ping(); err != nil {
return fmt.Errorf("cassandra unavailable before write: %w", err)
} Try / catch
if err := table.Exec(query, logger); err != nil {
var driverErr error
if unwrapped := errors.Unwrap(err); unwrapped != nil {
driverErr = unwrapped
}
log.Printf("cassandra write failed: %v (driver: %v)", err, driverErr)
// retry transient errors only
return retryTransient(driverErr)
} Prevention
- Run Jaeger's Cassandra schema init before starting writers.
- Monitor cluster health and add driver retry policies for transient failures.
- Log the query string (the error includes it) to catch schema drift early.
- Use readiness probes that check Cassandra connectivity before accepting traffic.
When it happens
Trigger: Any Insert/Update/Upsert statement executed through metrics.Table.Exec fails at the Cassandra driver level: connection loss, cluster down, timeout, query syntax error, schema/table missing, or write consistency issues.
Common situations: Cassandra node restart or network partition during a span/dependency write; keyspace or table dropped; invalid CQL after a schema migration; Cassandra unreachable at startup; tombstone/timeout errors under heavy write load.
Related errors
- error reading throughput from storage: %w
- error reading probabilities from storage: %w
- invalid version
- failed to acquire resource lock due to cassandra error: %w
- unknown column for position: %q
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/594ebdea05402161.
Report an issue: GitHub.