{"record":{"id":"042188b20a2ef152","repo":"gastownhall/beads","slug":"linear-team-id-not-configured","errorCode":null,"errorMessage":"Linear team ID not configured","messagePattern":"Linear team ID not configured","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/linear.go","lineNumber":1134,"sourceCode":"// Precedence: cliTeams (--team flag) > linear.team_ids > LINEAR_TEAM_IDS > linear.team_id > LINEAR_TEAM_ID\nfunc getLinearTeamIDs(ctx context.Context, cliTeams []string) []string {\n\tpluralVal, _ := getLinearConfig(ctx, \"linear.team_ids\")\n\tsingularVal, _ := getLinearConfig(ctx, \"linear.team_id\")\n\treturn tracker.ResolveProjectIDs(cliTeams, pluralVal, singularVal)\n}\n\n// getLinearClient creates a configured Linear client from beads config.\n// Uses the first configured team ID for operations that require a single team.\n//\n// Auth precedence:\n//  1. OAuth env vars (LINEAR_OAUTH_CLIENT_ID + LINEAR_OAUTH_CLIENT_SECRET)\n//  2. LINEAR_API_KEY env var\n//  3. linear.oauth_client_id + linear.oauth_client_secret in config\n//  4. linear.api_key in config\nfunc getLinearClient(ctx context.Context) (*linear.Client, error) {\n\tteamIDs := getLinearTeamIDs(ctx, nil)\n\tif len(teamIDs) == 0 {\n\t\treturn nil, fmt.Errorf(\"Linear team ID not configured\")\n\t}\n\n\tclient, err := buildLinearClient(ctx, teamIDs[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif store != nil {\n\t\tif endpoint, _ := store.GetConfig(ctx, \"linear.api_endpoint\"); endpoint != \"\" {\n\t\t\tclient = client.WithEndpoint(endpoint)\n\t\t}\n\t\tif projectID, _ := store.GetConfig(ctx, \"linear.project_id\"); projectID != \"\" {\n\t\t\tclient = client.WithProjectID(projectID)\n\t\t}\n\t\t// Apply optional rate-limit circuit-breaker floor.\n\t\t// Readable/settable via `bd config get/set linear.rate_limit_floor`.\n\t\t// Also honored via the LINEAR_RATE_LIMIT_FLOOR environment variable.\n\t\tfloorStr, _ := getLinearConfig(ctx, \"linear.rate_limit_floor\")","sourceCodeStart":1116,"sourceCodeEnd":1152,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/linear.go#L1116-L1152","documentation":"getLinearClient resolves team IDs using only configuration (no CLI flags are passed — cliTeams is nil). If no team ID is configured anywhere, it refuses to build a client and returns this short error.","triggerScenarios":"Any code path calling getLinearClient (e.g. background/daemon Linear operations, commands without --team) when linear.team_id/linear.team_ids config and LINEAR_TEAM_ID env are all unset.","commonSituations":"Daemon-driven sync where the CLI flag from an interactive command isn't available; environment where only the API key was configured but the team was never persisted.","solutions":["Persist the team: `bd config set linear.team_id \"TEAM_UUID\"`","Or set LINEAR_TEAM_ID in the environment of the process calling getLinearClient (e.g. the daemon)","For multiple teams use `bd config set linear.team_ids \"ID1,ID2\"`"],"exampleFix":"// before\nclient, err := getLinearClient(ctx) // Error: Linear team ID not configured\n// after\n// run once first:\n// bd config set linear.team_id \"12345678-1234-1234-1234-123456789abc\"\nclient, err := getLinearClient(ctx)","handlingStrategy":"validation","validationCode":"ids := getLinearTeamIDs(ctx, nil)\nif len(ids) == 0 {\n\treturn errors.New(\"persist linear.team_id before invoking operations that build a Linear client\")\n}","typeGuard":null,"tryCatchPattern":"client, err := getLinearClient(ctx)\nif err != nil && strings.Contains(err.Error(), \"team ID not configured\") {\n\t// set LINEAR_TEAM_ID in the daemon environment or bd config, retry\n}","preventionTips":["Persist team ID in bd config rather than relying on ephemeral CLI flags","Ensure daemon processes inherit LINEAR_TEAM_ID if env-based config is used","Run `bd linear teams` once during onboarding and record the UUID"],"tags":["configuration","linear","team","env-var"],"backgroundTag":"missing-config-key","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}