{"record":{"id":"dde4bbb9aa2e0871","repo":"gastownhall/beads","slug":"no-labels-connection-found-for-team","errorCode":null,"errorMessage":"no labels connection found for team","messagePattern":"no labels connection found for team","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/client.go","lineNumber":717,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"failed to fetch team labels: %w\", err)\n\t\t}\n\n\t\tvar page struct {\n\t\t\tTeam struct {\n\t\t\t\tLabels *struct {\n\t\t\t\t\tNodes    []Label `json:\"nodes\"`\n\t\t\t\t\tPageInfo struct {\n\t\t\t\t\t\tHasNextPage bool   `json:\"hasNextPage\"`\n\t\t\t\t\t\tEndCursor   string `json:\"endCursor\"`\n\t\t\t\t\t} `json:\"pageInfo\"`\n\t\t\t\t} `json:\"labels\"`\n\t\t\t} `json:\"team\"`\n\t\t}\n\t\tif err := json.Unmarshal(data, &page); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse team labels response: %w\", err)\n\t\t}\n\t\tif page.Team.Labels == nil {\n\t\t\treturn nil, fmt.Errorf(\"no labels connection found for team\")\n\t\t}\n\n\t\tall = append(all, page.Team.Labels.Nodes...)\n\t\tif !page.Team.Labels.PageInfo.HasNextPage {\n\t\t\tbreak\n\t\t}\n\t\tif page.Team.Labels.PageInfo.EndCursor == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tcursor := page.Team.Labels.PageInfo.EndCursor\n\t\tafter = &cursor\n\t}\n\n\treturn all, nil\n}\n\n// FindIssueByDescriptionContains searches for an issue whose description\n// contains the given text. This powers idempotency dedup: we embed a","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/client.go#L699-L735","documentation":"GetTeamLabels expects every page response to contain a non-nil `team.labels` connection. If the field decodes as nil (missing from the response), the client treats it as an unusable response and returns this error instead of silently returning zero labels.","triggerScenarios":"The GraphQL response omits data.team.labels entirely — team ID doesn't exist or isn't accessible with this key, GraphQL errors returned with partial data (error object present, labels absent), or the labels connection was renamed in a schema update.","commonSituations":"Misconfigured team ID (env var pointing to the wrong workspace), API key scoped without label read access, Linear schema rename of `labels`, intermittent GraphQL partial-error responses.","solutions":["Validate the team ID against `viewer.teams` or `teams { nodes { id name } }` using the same API key.","Inspect the response for a GraphQL `errors` array and propagate it, which usually explains why `labels` is null.","Check Linear API schema for renames (e.g. `issueLabels`) and update the query and struct.","Regenerate the API key with the correct scopes/team access."],"exampleFix":"// before\nif page.Team.Labels == nil {\n    return nil, fmt.Errorf(\"no labels connection found for team\")\n}\n// after\nif page.Team.Labels == nil {\n    return nil, fmt.Errorf(\"no labels connection found for team (verify team ID and API key scopes)\")\n}","handlingStrategy":"validation","validationCode":"// resolve and verify the team before building caches\nteams, err := client.GetTeams(ctx)\nif err != nil || len(teams) == 0 {\n    return errors.New(\"no accessible Linear teams for this API key\")\n}\n// use teams[i].Id when initializing the client","typeGuard":"func labelsPresent(page struct{ Team struct{ Labels *struct{} } }) bool {\n    return page.Team.Labels != nil\n}","tryCatchPattern":"labels, err := client.GetTeamLabels(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"no labels connection\") {\n        log.Printf(\"team %s has no accessible labels; skipping label cache\", teamID)\n        return nil // degrade gracefully\n    }\n    return err\n}","preventionTips":["Resolve team IDs dynamically from the API instead of config/env.","Check the response's GraphQL errors array when labels is null.","Keep the query aligned with the current Linear schema.","Use a service account key with confirmed team access."],"tags":["graphql","linear","nil-check","api-response"],"backgroundTag":"empty-or-missing-api-response","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}