dagger/dagger · error
flush telemetry: %w
Error message
flush telemetry: %w
What it means
The ClientTelemetry API flushes ALL clients in the session (so buffered spans from nested clients are complete before captureLogs walks the span tree) and wraps any flush failure from daggerSession.FlushTelemetry as "flush telemetry: %w".
Source
Thrown at engine/server/session.go:2951
func (srv *Server) FlushSessionTelemetry(ctx context.Context) error {
client, err := srv.clientFromContext(ctx)
if err != nil {
return err
}
return client.daggerSession.FlushTelemetry(ctx, "FlushSessionTelemetry API")
}
func (srv *Server) ClientTelemetry(ctx context.Context, sessID, clientID string) (*clientdb.DB, error) {
client, err := srv.clientFromIDs(sessID, clientID)
if err != nil {
return nil, err
}
// Flush ALL clients in the session, not just the requested one.
// Spans from nested clients may still be buffered in their
// BatchSpanProcessor. A session-wide flush ensures the span tree
// is complete before captureLogs walks it via SelectLogsBeneathSpan.
if err := client.daggerSession.FlushTelemetry(ctx, "ClientTelemetry API"); err != nil {
return nil, fmt.Errorf("flush telemetry: %w", err)
}
return client.TelemetryDB(ctx)
}
// Return a client connected to a cloud engine. If bool return is false, the local engine should be used. Session attachables for the returned client will be proxied back to the calling client.
func (srv *Server) CloudEngineClient(
ctx context.Context,
module string,
function string,
execCmd []string,
) (*engineclient.Client, bool, error) {
parentClient, err := srv.nonModuleParentClient(ctx)
if err != nil {
return nil, false, err
}
parentCallerCtx := engine.ContextWithClientMetadata(ctx, parentClient.clientMetadata)
parentSession, err := parentClient.engineUtilClient.GetSessionCaller(parentCallerCtx)
if err != nil {View on GitHub (pinned to 82ba2681db)
Solutions
- Read the wrapped cause (%w) to see the underlying flush/export failure and fix it (network, auth, sink)
- Retry the ClientTelemetry call after a short delay so the span processor can drain
- Avoid cancelling the parent context before telemetry capture completes; keep the session alive until capture finishes
Example fix
// before
db, err := client.ClientTelemetry(ctx)
// after
db, err := client.ClientTelemetry(ctx)
if err != nil && strings.Contains(err.Error(), "flush telemetry") {
time.Sleep(500 * time.Millisecond)
db, err = client.ClientTelemetry(ctx)
} Defensive patterns
Strategy: retry
Validate before calling
// no pre-check possible; ensure session still active and context not cancelled
if ctx.Err() != nil { return ctx.Err() } Try / catch
db, err := client.ClientTelemetry(ctx)
if err != nil && strings.Contains(err.Error(), "flush telemetry") {
// inspect wrapped cause, retry once after delay
} Prevention
- Don't cancel the context before telemetry capture
- Keep the session alive until spans are flushed
- Retry transient flush failures with backoff
When it happens
Trigger: Calling the ClientTelemetry API when the session-wide BatchSpanProcessor flush fails — e.g. the telemetry export pipeline/shutdown path errors, or the context is cancelled mid-flush.
Common situations: Capturing telemetry/logs right after a command completes while span export to the backend is slow or failing; network issues reaching the telemetry sink; context cancelled during a long-running session teardown.
Related errors
- select spans: %w
- export %d spans: %w
- collect_jsonable nil core object %q: %w
- collect_jsonable input core object %q (%T): %w
- collect_id core object %q (%T): %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/681524b6a2611f58.
Report an issue: GitHub.