GoogleContainerTools/skaffold · error
error initializing trace exporter
Error message
error initializing trace exporter
What it means
initTraceExporter sets up the OpenTelemetry trace exporter for skaffold's performance tracing. If no trace exporter could be created/registered, it returns a fixed error "error initializing trace exporter". Notably, if the OTEL_TRACES_EXPORTER environment variable is set, skaffold defers to the otel default and returns success instead.
Source
Thrown at pkg/skaffold/instrumentation/export.go:385
case "stdout":
log.Entry(context.TODO()).Debug("using stdout trace exporter")
return initIOWriterTracer(teconf.writer)
case "gcp-adc":
log.Entry(context.TODO()).Debug("using cloud trace exporter w/ application default creds")
tp, shutdown, err := initCloudTraceExporterApplicationDefaultCreds()
return tp, func(context.Context) error { shutdown(); return nil }, err
case "jaeger":
log.Entry(context.TODO()).Debug("using jaeger trace exporter")
tp, shutdown, err := initJaegerTraceExporter()
return tp, func(context.Context) error { shutdown(); return nil }, err
}
if otelTraceExporterVal, ok := os.LookupEnv("OTEL_TRACES_EXPORTER"); ok {
log.Entry(context.TODO()).Debugf("using otel default exporter - OTEL_TRACES_EXPORTER=%s", otelTraceExporterVal)
return nil, func(context.Context) error { return nil }, nil
}
return nil, func(context.Context) error { return nil }, fmt.Errorf("error initializing trace exporter")
}
// initIOWriterTracer creates and registers trace provider instance that writes to an io.Writer interface
func initIOWriterTracer(w io.Writer) (*sdktrace.TracerProvider, func(context.Context) error, error) {
exp, err := stdouttrace.New(
stdouttrace.WithWriter(w),
stdouttrace.WithPrettyPrint(),
)
if err != nil {
return nil, func(context.Context) error { return nil }, err
}
bsp := sdktrace.NewBatchSpanProcessor(exp)
tp := sdktrace.NewTracerProvider(
sdktrace.WithSampler(sdktrace.AlwaysSample()),
sdktrace.WithSpanProcessor(bsp),
)
return tp, tp.Shutdown, nil
}View on GitHub (pinned to a1189de023)
Solutions
- Set OTEL_TRACES_EXPORTER (e.g. `export OTEL_TRACES_EXPORTER=otlp`) so the otel default exporter is used.
- Check the flags passed (--trace/--rpc-trace) and the wrapped diagnostics for exporter setup failures.
- Ensure the OTEL SDK exporter dependencies/configuration are valid if customizing tracing.
Example fix
// before skaffold dev --trace # no exporter configured // after export OTEL_TRACES_EXPORTER=otlp skaffold dev --trace
Defensive patterns
Strategy: fallback
Validate before calling
if os.Getenv("OTEL_TRACES_EXPORTER") == "" && tracingRequested {
log.Println("set OTEL_TRACES_EXPORTER to avoid trace exporter init failure")
} Try / catch
if err := skaffoldRun(); err != nil {
if err.Error() == "error initializing trace exporter" {
// retry without --trace, or set OTEL_TRACES_EXPORTER and retry
}
} Prevention
- Export OTEL_TRACES_EXPORTER when tracing is enabled
- Only pass --trace when an exporter is configured
- Verify OTEL env vars in the actual execution environment (CI may strip them)
When it happens
Trigger: Running skaffold with tracing enabled (--trace or --rpc-trace) when skaffold cannot initialize its trace exporter and OTEL_TRACES_EXPORTER is not set in the environment.
Common situations: Users enabling tracing without any exporter configuration; missing or invalid trace output options; OTEL env vars not exported in the shell.
Related errors
- value must be one of `always`, `missing`, or `never`
- CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR
- CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR
- INSPECT_BUILD_ENV_ALREADY_EXISTS_ERR
- INSPECT_BUILD_ENV_INCORRECT_TYPE_ERR
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/d82d7d64e326ac7b.
Report an issue: GitHub.