{"record":{"id":"a77f11cd963d39ce","repo":"gastownhall/beads","slug":"github-tracker-not-initialized","errorCode":null,"errorMessage":"GitHub tracker not initialized","messagePattern":"GitHub tracker not initialized","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/github/tracker.go","lineNumber":86,"sourceCode":"\tif repo == \"\" {\n\t\treturn fmt.Errorf(\"GitHub repo not configured (set github.repo or GITHUB_REPO)\")\n\t}\n\n\tt.client = NewClient(token, owner, repo)\n\n\t// Allow custom base URL for GitHub Enterprise\n\tbaseURL := t.getConfig(ctx, \"github.url\", \"GITHUB_API_URL\")\n\tif baseURL != \"\" {\n\t\tt.client = t.client.WithBaseURL(baseURL)\n\t}\n\n\tt.config = DefaultMappingConfig()\n\treturn nil\n}\n\nfunc (t *Tracker) Validate() error {\n\tif t.client == nil {\n\t\treturn fmt.Errorf(\"GitHub 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\tvar issues []Issue\n\tvar err error\n\n\tstate := opts.State\n\tif state == \"\" {\n\t\tstate = \"all\"\n\t}\n\n\tif opts.Since != nil {\n\t\tissues, err = t.client.FetchIssuesSince(ctx, state, *opts.Since)\n\t} else {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/github/tracker.go#L68-L104","documentation":"Tracker.Validate is a precondition check ensuring Init was called successfully: it only verifies that the internal HTTP client is non-nil. A nil client means the tracker struct exists but was never initialized, so no GitHub operations can proceed.","triggerScenarios":"Calling any operation that runs Validate on a zero-value Tracker, or on a Tracker whose Init returned early/failed, leaving t.client nil.","commonSituations":"Constructing github.Tracker{} directly instead of via Init, ignoring the error from Init and continuing, or reusing a Tracker across a failed configuration change.","solutions":["Call tracker.Init(ctx) successfully before using the tracker.","Check and handle the error returned by Init (see also the repo/owner configuration errors).","Ensure you are using the initialized Tracker instance, not a fresh zero-value struct.","Add a Validate() call in your own setup code to fail fast with a clear message."],"exampleFix":"// before\nt := &github.Tracker{}\nt.FetchIssue(ctx, \"12\")\n// after\nt := &github.Tracker{}\nif err := t.Init(ctx); err != nil { return err }\nif err := t.Validate(); err != nil { return err }","handlingStrategy":"try-catch","validationCode":"if err := t.Validate(); err != nil { return fmt.Errorf(\"tracker unusable: %w\", err) } // call after Init, before use","typeGuard":null,"tryCatchPattern":"if err := t.Init(ctx); err != nil { return err }\nif err := t.Validate(); err != nil { return fmt.Errorf(\"init did not complete: %w\", err) }","preventionTips":["Always construct trackers via a factory that runs Init, never as a bare struct literal.","Check Init's return error immediately; never continue on failure.","Call Validate once during application startup as a cheap invariant check."],"tags":["github","initialization","lifecycle"],"backgroundTag":"tracker-not-initialized","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}