{"record":{"id":"8c50ac4b8df7d29d","repo":"gastownhall/beads","slug":"fetching-issues-from-team-s-w","errorCode":null,"errorMessage":"fetching issues from team %s: %w","messagePattern":"fetching issues from team (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/tracker.go","lineNumber":151,"sourceCode":"\n\tseen := make(map[string]bool)\n\tvar result []tracker.TrackerIssue\n\n\tfor _, teamID := range t.teamIDs {\n\t\tclient := t.clients[teamID]\n\t\tif client == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar issues []Issue\n\t\tvar err error\n\t\tif opts.Since != nil {\n\t\t\tissues, err = client.FetchIssuesSince(ctx, state, *opts.Since)\n\t\t} else {\n\t\t\tissues, err = client.FetchIssues(ctx, state)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn result, fmt.Errorf(\"fetching issues from team %s: %w\", teamID, err)\n\t\t}\n\n\t\tfor _, li := range issues {\n\t\t\tif seen[li.ID] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tseen[li.ID] = true\n\t\t\tresult = append(result, linearToTrackerIssue(&li))\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\nfunc (t *Tracker) FetchIssue(ctx context.Context, identifier string) (*tracker.TrackerIssue, error) {\n\t// Try the primary client first (first team), then others.\n\tfor _, teamID := range t.teamIDs {\n\t\tclient := t.clients[teamID]","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/tracker.go#L133-L169","documentation":"FetchIssues iterates the configured Linear teams and calls the per-team client's FetchIssues/FetchIssuesSince GraphQL query. If the remote fetch for a team fails, the partial results collected so far are returned alongside this error wrapping the underlying client error with the team ID. The Linear API error (rate limit, auth, network, GraphQL errors) is the wrapped cause.","triggerScenarios":"Calling FetchIssues when a team's client request fails: expired/revoked API key, rate limiting, network outage or timeout, invalid team ID, or Linear GraphQL errors during FetchIssues/FetchIssuesSince.","commonSituations":"Rotated Linear API keys not updated in config; hitting Linear's rate limits during large initial syncs; corporate proxy/firewall blocking api.linear.app; typo'd team key that Linear rejects; transient DNS/network failures on CI.","solutions":["Inspect the wrapped cause (%w) — fix auth errors by refreshing LINEAR_API_KEY/OAuth credentials","Retry on rate-limit/network errors; the client honors a configurable rate-limit floor (linear.rate_limit_floor) you can raise","Verify the team ID is a valid Linear team key for your workspace","Check network/proxy reachability to https://api.linear.app from the failing environment"],"exampleFix":"// before: one-shot fetch that dies on transient errors\nissues, err := tr.FetchIssues(ctx, opts)\nif err != nil { return err }\n// after: retry with backoff\nvar issues []tracker.TrackerIssue\nerr := retry.Do(func() error {\n    var e error\n    issues, e = tr.FetchIssues(ctx, opts)\n    return e\n}, retry.Attempts(3), retry.Delay(2*time.Second))","handlingStrategy":"retry","validationCode":"// Reachability pre-check before sync\nctx, cancel := context.WithTimeout(ctx, 10*time.Second)\ndefer cancel()\nresp, err := http.Get(\"https://api.linear.app/\")\nif err != nil { return fmt.Errorf(\"Linear unreachable: %w\", err) }\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"issues, err := tr.FetchIssues(ctx, opts)\nif err != nil {\n    var teamErr string\n    if strings.Contains(err.Error(), \"fetching issues from team\") {\n        return retry.Do(func() error { // transient network/rate-limit\n            issues, err = tr.FetchIssues(ctx, opts)\n            return err\n        }, retry.Attempts(3), retry.BackoffDelay)\n    }\n    return err\n}","preventionTips":["Handle errors.As on wrapped causes to distinguish auth vs rate-limit vs network","Set linear.rate_limit_floor for large initial syncs to avoid 429s","Rotate/update LINEAR_API_KEY promptly after key revocation","Verify network/proxy access to api.linear.app in restricted environments"],"tags":["network","api","linear","rate-limit"],"backgroundTag":"api-request-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}