{"record":{"id":"cc188074c603c1de","repo":"gastownhall/beads","slug":"linear-tracker-not-initialized","errorCode":null,"errorMessage":"Linear tracker not initialized","messagePattern":"Linear tracker not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/tracker.go","lineNumber":121,"sourceCode":"\t\tif endpoint != \"\" {\n\t\t\tclient = client.WithEndpoint(endpoint)\n\t\t}\n\t\tif projectID != \"\" {\n\t\t\tclient = client.WithProjectID(projectID)\n\t\t}\n\t\tif rateLimitFloor > 0 {\n\t\t\tclient = client.WithRateLimitFloor(rateLimitFloor)\n\t\t}\n\t\tt.clients[teamID] = client\n\t}\n\n\tt.config = LoadMappingConfig(&configLoaderAdapter{ctx: ctx, store: store})\n\treturn nil\n}\n\nfunc (t *Tracker) Validate() error {\n\tif len(t.clients) == 0 {\n\t\treturn fmt.Errorf(\"Linear tracker not initialized\")\n\t}\n\treturn nil\n}\n\nfunc (t *Tracker) Close() error { return nil }\n\nfunc (t *Tracker) FetchIssues(ctx context.Context, opts tracker.FetchOptions) ([]tracker.TrackerIssue, error) {\n\tstate := opts.State\n\tif state == \"\" {\n\t\tstate = \"all\"\n\t}\n\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 {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/tracker.go#L103-L139","documentation":"Tracker.Validate is a precondition check: it succeeds only when Init has created at least one per-team client (len(t.clients) > 0). If the Tracker struct was never initialized — or Init failed or was skipped — the client map is empty and this error is returned. It is an internal lifecycle/liveness guard, not an API-level failure.","triggerScenarios":"Calling Validate on a zero-value &linear.Tracker{} that never had Init called; calling Validate after a failed Init; or custom code constructing the Tracker directly instead of through the tracker registry and calling operations before Init.","commonSituations":"Embedding bd's linear tracker in other tooling and forgetting Init; error-swallowing wrappers that ignore Init's return error and proceed to Validate/sync; tests instantiating Tracker manually.","solutions":["Ensure Tracker.Init(ctx, store) is called and its error handled before any other tracker method","If Init failed, fix the underlying cause (missing credentials/team config) and retry Init","Use the tracker registry (tracker.Register/lookup) so the tracker is constructed and initialized through the normal lifecycle","In code, guard with tracker.Validate() and surface the error instead of proceeding to API calls"],"exampleFix":"// before: ignoring Init error\ntracker := &linear.Tracker{}\n_ = tracker.Init(ctx, store)\nif err := tracker.Validate(); err != nil { ... }\n// after\ntracker := &linear.Tracker{}\nif err := tracker.Init(ctx, store); err != nil {\n    return fmt.Errorf(\"initializing linear tracker: %w\", err)\n}\nif err := tracker.Validate(); err != nil { return err }","handlingStrategy":"validation","validationCode":"// Ensure lifecycle order before using the tracker\ntracker := &linear.Tracker{}\nif err := tracker.Init(ctx, store); err != nil {\n    return fmt.Errorf(\"linear init: %w\", err)\n}\nif err := tracker.Validate(); err != nil {\n    return fmt.Errorf(\"linear validate: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := tr.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"not initialized\") {\n        return fmt.Errorf(\"call Tracker.Init before use: %w\", err)\n    }\n    return err\n}","preventionTips":["Always call Init and check its error before any tracker operation","Construct trackers through the registry (tracker.Register/lookup), not bare struct literals","Call Validate early in command entry points to fail fast","Never swallow Init errors with _ ="],"tags":["initialization","lifecycle","linear","go"],"backgroundTag":"not-initialized","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}