{"record":{"id":"2f8918b34254aed0","repo":"gastownhall/beads","slug":"failed-to-parse-issues-response-w-2f8918","errorCode":null,"errorMessage":"failed to parse issues response: %w","messagePattern":"failed to parse issues response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/client.go","lineNumber":511,"sourceCode":"\t\t\t\"first\":  MaxPageSize,\n\t\t}\n\t\tif cursor != \"\" {\n\t\t\tvariables[\"after\"] = cursor\n\t\t}\n\n\t\treq := &GraphQLRequest{\n\t\t\tQuery:     issuesQuery,\n\t\t\tVariables: variables,\n\t\t}\n\n\t\tdata, err := c.Execute(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to fetch issues: %w\", err)\n\t\t}\n\n\t\tvar issuesResp IssuesResponse\n\t\tif err := json.Unmarshal(data, &issuesResp); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse issues response: %w\", err)\n\t\t}\n\n\t\tallIssues = append(allIssues, issuesResp.Issues.Nodes...)\n\n\t\tif !issuesResp.Issues.PageInfo.HasNextPage {\n\t\t\tbreak\n\t\t}\n\t\tcursor = issuesResp.Issues.PageInfo.EndCursor\n\t}\n\n\treturn allIssues, nil\n}\n\n// FetchIssuesSince retrieves issues from Linear that have been updated since the given time.\n// This enables incremental sync by only fetching issues modified after the last sync.\n// The state parameter can be: \"open\", \"closed\", or \"all\".\n// If ProjectID is set on the client, only issues from that project are returned.\nfunc (c *Client) FetchIssuesSince(ctx context.Context, state string, since time.Time) ([]Issue, error) {","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/client.go#L493-L529","documentation":"FetchIssues failed to JSON-unmarshal the 'data' payload returned by Linear into IssuesResponse. This means the response shape didn't match the client's expected `issues.nodes`/`pageInfo` structure.","triggerScenarios":"Execute returned successfully but the data payload doesn't fit IssuesResponse: Linear API schema change (fields renamed/removed in issuesQuery), a partial-data response, or unexpected nullability causing decode mismatches.","commonSituations":"Linear shipped a GraphQL schema change and the vendored client's query/response structs are outdated; a proxy/intercepting layer mangled the JSON; running an old beads binary against a newer Linear API.","solutions":["Log the raw data payload (json.RawMessage) to see the actual response shape","Compare issuesQuery against Linear's current GraphQL schema","Upgrade the client/beads to a version matching Linear's current API","If a field type changed, update the Issue/IssuesResponse structs accordingly"],"exampleFix":"// after: capture the raw payload for diagnosis\ndata, err := c.Execute(ctx, req)\nif err != nil { return nil, err }\nlog.Printf(\"linear raw page: %s\", string(data))\nvar issuesResp IssuesResponse\nif err := json.Unmarshal(data, &issuesResp); err != nil {\n    return nil, fmt.Errorf(\"failed to parse issues response: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// Guard against a truncated/nil issues node before use\nfunc validIssuesResponse(raw json.RawMessage) bool {\n    var probe struct {\n        Issues *struct {\n            PageInfo struct{ HasNextPage bool } `json:\"pageInfo\"`\n        } `json:\"issues\"`\n    }\n    return json.Unmarshal(raw, &probe) == nil && probe.Issues != nil\n}","tryCatchPattern":"issues, err := client.FetchIssues(ctx, \"all\")\nif err != nil && strings.Contains(err.Error(), \"failed to parse issues response\") {\n    // likely Linear schema drift: capture payload via debug logging, stop retrying\n    return fmt.Errorf(\"client/API version mismatch: %w\", err)\n}","preventionTips":["Keep the client version current with Linear's API changelog","Log raw response payloads on parse failure for postmortems","Avoid mutating the JSON between receive and decode (no rewriting proxies)","Add a CI smoke test that performs a real (or recorded) fetch and decodes it"],"tags":["json","parsing","linear","schema"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}