> ## Documentation Index
> Fetch the complete documentation index at: https://docs.braintrust.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Diagnose and fix common issues when installing or using the Braintrust Go SDK.

This page outlines common issues when setting up and using the Braintrust Go SDK and how to resolve them.

> [accordion] No traces after adding the SDK
>
> Confirm that your application initializes Braintrust during startup and uses the tracer provider you registered with OpenTelemetry:
>
> ```go theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> tp := trace.NewTracerProvider()
> otel.SetTracerProvider(tp)
>
> _, err := braintrust.New(tp, braintrust.WithProject("My project"))
> if err != nil {
> 	log.Fatal(err)
> }
> ```
>
> Also confirm that `BRAINTRUST_API_KEY` is set in the environment used to run the application.

> [accordion] Provider calls are not auto-instrumented
>
> Auto-instrumentation only works when your app is built or run through Orchestrion. Use the same command path your team uses in development, CI, or production:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> orchestrion go run .
> orchestrion go build ./...
> ```
>
> If the app is run with plain `go run` or `go build`, Orchestrion will not inject provider instrumentation.

> [accordion] An integration package is missing
>
> Make sure `orchestrion.tool.go` imports the contrib package for the provider library your app uses, then run `go mod tidy`:
>
> ```go #skip-compile theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> //go:build tools
>
> package main
>
> import (
> 	_ "github.com/DataDog/orchestrion"
> 	_ "github.com/braintrustdata/braintrust-sdk-go/trace/contrib/openai"
> )
> ```
>
> See [SDK integrations](https://docs.braintrust.dev/sdks/go/sdk-integrations.md) for supported import paths.

> [accordion] Traces are written to the wrong project
>
> Pass the target project when creating the Braintrust client:
>
> ```go theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> _, err := braintrust.New(tp, braintrust.WithProject("My project"))
> if err != nil {
> 	log.Fatal(err)
> }
> ```

> [accordion] No traces from a short-lived program
>
> Short-lived programs can exit before spans are exported. Shut down the tracer provider before the process exits:
>
> ```go theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> defer func() {
> 	if err := tp.Shutdown(context.Background()); err != nil {
> 		log.Printf("failed to shut down tracer provider: %v", err)
> 	}
> }()
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.