{"record":{"id":"32e6376a0ed4e4fd","repo":"gastownhall/beads","slug":"no-linear-client-available-32e637","errorCode":null,"errorMessage":"no Linear client available","messagePattern":"no Linear client available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/tracker.go","lineNumber":188,"sourceCode":"\t\tif client == nil {\n\t\t\tcontinue\n\t\t}\n\t\tli, err := client.FetchIssueByIdentifier(ctx, identifier)\n\t\tif err != nil {\n\t\t\tcontinue // Issue might belong to a different team.\n\t\t}\n\t\tif li != nil {\n\t\t\tti := linearToTrackerIssue(li)\n\t\t\treturn &ti, nil\n\t\t}\n\t}\n\treturn nil, nil\n}\n\nfunc (t *Tracker) CreateIssue(ctx context.Context, issue *types.Issue) (*tracker.TrackerIssue, error) {\n\tclient := t.primaryClient()\n\tif client == nil {\n\t\treturn nil, fmt.Errorf(\"no Linear client available\")\n\t}\n\n\tpriority := PriorityToLinear(issue.Priority, t.config)\n\n\tstateID, err := t.findStateID(ctx, client, issue.Status)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"finding state for status %s: %w\", issue.Status, err)\n\t}\n\n\tlabelCache, err := BuildLabelCache(ctx, client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading team labels: %w\", err)\n\t}\n\tlabelIDs, unknown := ResolveLabelIDs(issue, labelCache, t.config)\n\tfor _, name := range unknown {\n\t\tfmt.Fprintf(os.Stderr, \"linear: bead %s: label %q not found on Linear team (skipped)\\n\", issue.ID, name)\n\t}\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/tracker.go#L170-L206","documentation":"CreateIssue requires the primary team's client (the first entry in teamIDs, via primaryClient). If the tracker has no team IDs configured or the primary client was never created, it returns this error instead of attempting a GraphQL mutation. Like Validate, it is a lifecycle guard indicating the tracker was not properly initialized.","triggerScenarios":"Calling CreateIssue on a Tracker where Init was never called, Init failed before clients were built (e.g. missing team ID), or teamIDs is empty while clients map is nil/empty.","commonSituations":"Calling CreateIssue before Init in custom tooling; Init failing at the team-ID check (see error 1946) and the caller proceeding anyway; constructing a zero-value Tracker in tests.","solutions":["Call Init successfully (credentials AND team ID configured) before CreateIssue, and check its error","Configure a primary team (linear.team_id or --team) so primaryClient() resolves","Call tracker.Validate() before the sync/push loop to fail fast with a clearer message","In tests, use the tracker registry and full Init flow rather than a bare &Tracker{}"],"exampleFix":"// before\ntracker := &linear.Tracker{}\ncreated, err := tracker.CreateIssue(ctx, issue) // \"no Linear client available\"\n// after\ntracker := &linear.Tracker{}\ntracker.SetTeamIDs([]string{\"ENG\"})\nif err := tracker.Init(ctx, store); err != nil { return err }\ncreated, err := tracker.CreateIssue(ctx, issue)","handlingStrategy":"validation","validationCode":"// Guard lifecycle before creates\ntracker := &linear.Tracker{}\nif err := tracker.Init(ctx, store); err != nil { return err }\nif err := tracker.Validate(); err != nil { return err } // fails if clients map empty","typeGuard":null,"tryCatchPattern":"created, err := tr.CreateIssue(ctx, issue)\nif err != nil {\n    if strings.Contains(err.Error(), \"no Linear client available\") {\n        return fmt.Errorf(\"tracker not initialized; call Init with team/credentials first: %w\", err)\n    }\n    return err\n}","preventionTips":["Enforce Init -> Validate -> use ordering in all sync/push code paths","Configure a primary team so primaryClient() is non-nil","Don't ignore Init errors and continue to create/push operations","In tests and tooling, instantiate trackers via the registry with full initialization"],"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"}