{"record":{"id":"d82d7d64e326ac7b","repo":"GoogleContainerTools/skaffold","slug":"error-initializing-trace-exporter","errorCode":null,"errorMessage":"error initializing trace exporter","messagePattern":"error initializing trace exporter","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/instrumentation/export.go","lineNumber":385,"sourceCode":"\tcase \"stdout\":\n\t\tlog.Entry(context.TODO()).Debug(\"using stdout trace exporter\")\n\t\treturn initIOWriterTracer(teconf.writer)\n\tcase \"gcp-adc\":\n\t\tlog.Entry(context.TODO()).Debug(\"using cloud trace exporter w/ application default creds\")\n\t\ttp, shutdown, err := initCloudTraceExporterApplicationDefaultCreds()\n\t\treturn tp, func(context.Context) error { shutdown(); return nil }, err\n\tcase \"jaeger\":\n\t\tlog.Entry(context.TODO()).Debug(\"using jaeger trace exporter\")\n\t\ttp, shutdown, err := initJaegerTraceExporter()\n\t\treturn tp, func(context.Context) error { shutdown(); return nil }, err\n\t}\n\n\tif otelTraceExporterVal, ok := os.LookupEnv(\"OTEL_TRACES_EXPORTER\"); ok {\n\t\tlog.Entry(context.TODO()).Debugf(\"using otel default exporter - OTEL_TRACES_EXPORTER=%s\", otelTraceExporterVal)\n\t\treturn nil, func(context.Context) error { return nil }, nil\n\t}\n\n\treturn nil, func(context.Context) error { return nil }, fmt.Errorf(\"error initializing trace exporter\")\n}\n\n// initIOWriterTracer creates and registers trace provider instance that writes to an io.Writer interface\nfunc initIOWriterTracer(w io.Writer) (*sdktrace.TracerProvider, func(context.Context) error, error) {\n\texp, err := stdouttrace.New(\n\t\tstdouttrace.WithWriter(w),\n\t\tstdouttrace.WithPrettyPrint(),\n\t)\n\tif err != nil {\n\t\treturn nil, func(context.Context) error { return nil }, err\n\t}\n\tbsp := sdktrace.NewBatchSpanProcessor(exp)\n\ttp := sdktrace.NewTracerProvider(\n\t\tsdktrace.WithSampler(sdktrace.AlwaysSample()),\n\t\tsdktrace.WithSpanProcessor(bsp),\n\t)\n\treturn tp, tp.Shutdown, nil\n}","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/instrumentation/export.go#L367-L403","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users enabling tracing without any exporter configuration; missing or invalid trace output options; OTEL env vars not exported in the shell.","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."],"exampleFix":"// before\nskaffold dev --trace  # no exporter configured\n// after\nexport OTEL_TRACES_EXPORTER=otlp\nskaffold dev --trace","handlingStrategy":"fallback","validationCode":"if os.Getenv(\"OTEL_TRACES_EXPORTER\") == \"\" && tracingRequested {\n    log.Println(\"set OTEL_TRACES_EXPORTER to avoid trace exporter init failure\")\n}","typeGuard":null,"tryCatchPattern":"if err := skaffoldRun(); err != nil {\n    if err.Error() == \"error initializing trace exporter\" {\n        // retry without --trace, or set OTEL_TRACES_EXPORTER and retry\n    }\n}","preventionTips":["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)"],"tags":["tracing","opentelemetry","configuration"],"backgroundTag":"trace-exporter-init-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}