jaegertracing/jaeger · error

%s: %w

Error message

%s: %w

What it means

logError is the SpanWriter's uniform error funnel: it logs the failed write step (msg) with trace ID, span ID and the underlying error, then returns fmt.Errorf("%s: %w", msg, err). Callers (writeSpanToDB, writeIndexes, indexByTags) pass messages like 'failed to save service name' or 'failed to write index', so the surfaced error combines the step name with the Cassandra cause.

Source

Thrown at internal/storage/v1/cassandra/spanstore/writer.go:280

		var js json.RawMessage
		// poor man's string-is-a-json check shortcircuits full unmarshalling
		return strings.HasPrefix(s, "{") && json.Unmarshal([]byte(s), &js) == nil
	}

	return len(tag.TagKey) < maximumTagKeyOrValueSize &&
		len(tag.TagValue) < maximumTagKeyOrValueSize &&
		utf8.ValidString(tag.TagValue) &&
		utf8.ValidString(tag.TagKey) &&
		!isJSON(tag.TagValue)
}

func (*SpanWriter) logError(span *dbmodel.Span, err error, msg string, logger *zap.Logger) error {
	logger.
		With(zap.String("trace_id", span.TraceID.String())).
		With(zap.Int64("span_id", span.SpanID)).
		With(zap.Error(err)).
		Error(msg)
	return fmt.Errorf("%s: %w", msg, err)
}

func (s *SpanWriter) saveServiceNameAndOperationName(operation dbmodel.Operation) error {
	if err := s.serviceNamesWriter(operation.ServiceName); err != nil {
		return err
	}
	return s.operationNamesWriter(operation)
}

View on GitHub (pinned to 806f444784)

Solutions

  1. Read the logged msg + wrapped error to identify the failing step and root Cassandra cause.
  2. Retry the span write; Jaeger writes are idempotent for the same span/ID.
  3. Address cluster write health: timeouts, replication, nodetool repair.
  4. Check for oversized spans (huge tag payloads, max_trace/archive limits) and adjust writer config or data.
Defensive patterns

Strategy: try-catch

Try / catch

if err := writer.WriteSpan(ctx, span); err != nil {
    // err embeds the failing step ('failed to write index', etc.) plus the
    // Cassandra cause; log spanID/traceID and retry or drop per policy
    logger.Error("span write failed", zap.Error(err))
}

Prevention

When it happens

Trigger: Any span write path failing: inserting into traces, writing duration/service-name/operation indexes or tag indexes when Cassandra rejects or times out the write — write timeout, unavailable, consistency failure, or oversized data.

Common situations: Cassandra write timeouts under load; batch of index writes exceeding limits; keyspace misconfiguration on a fresh deployment; too many tags creating large rows; node outages.

Related errors


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