{"record":{"id":"ff29ed6d938f0cb9","repo":"gastownhall/beads","slug":"failed-to-parse-update-project-response-w","errorCode":null,"errorMessage":"failed to parse update project response: %w","messagePattern":"failed to parse update project response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/client.go","lineNumber":1584,"sourceCode":"\t\t}\n\t`\n\n\treq := &GraphQLRequest{\n\t\tQuery: query,\n\t\tVariables: map[string]interface{}{\n\t\t\t\"id\":    projectID,\n\t\t\t\"input\": updates,\n\t\t},\n\t}\n\n\tdata, err := c.Execute(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to update project: %w\", err)\n\t}\n\n\tvar updateResp ProjectUpdateResponse\n\tif err := json.Unmarshal(data, &updateResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse update project response: %w\", err)\n\t}\n\n\tif !updateResp.ProjectUpdate.Success {\n\t\treturn nil, fmt.Errorf(\"project update reported as unsuccessful\")\n\t}\n\n\treturn &updateResp.ProjectUpdate.Project, nil\n}\n","sourceCodeStart":1566,"sourceCodeEnd":1593,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/client.go#L1566-L1593","documentation":"UpdateProject fails with this when the raw JSON returned by Linear cannot be unmarshaled into ProjectUpdateResponse. This indicates the HTTP call succeeded but the payload shape is not what this client expects — an API contract change or a non-JSON response (proxy error page, HTML error, truncated body).","triggerScenarios":"Client.UpdateProject receives data whose JSON structure does not match ProjectUpdateResponse (missing/renamed fields, wrong content type, HTML error page from a proxy, truncated response).","commonSituations":"Corporate proxy or auth gateway returning an HTML login page, Linear API schema changes after an update, misconfigured base URL pointing at a non-Linear endpoint, response truncation on very large payloads.","solutions":["Log the raw response body (data) at failure time to see what was actually returned.","Verify the client's base URL points to the official Linear GraphQL endpoint.","Check for proxy/gateway interference (HTML instead of JSON) in the response body.","Update the client library if Linear changed the ProjectUpdate payload shape.","Confirm Content-Type of the response is application/json."],"exampleFix":"// before\nif err := json.Unmarshal(data, &updateResp); err != nil {\n\treturn nil, fmt.Errorf(\"failed to parse update project response: %w\", err)\n}\n// after\nif err := json.Unmarshal(data, &updateResp); err != nil {\n\treturn nil, fmt.Errorf(\"failed to parse update project response: %w (body: %.200s)\", err, data)\n}","handlingStrategy":"validation","validationCode":"if len(data) == 0 {\n\treturn fmt.Errorf(\"empty response body from Linear\")\n}\nif !json.Valid(data) {\n\treturn fmt.Errorf(\"non-JSON response from Linear: %.100s\", data)\n}","typeGuard":null,"tryCatchPattern":"var updateResp ProjectUpdateResponse\nif err := json.Unmarshal(data, &updateResp); err != nil {\n\tlog.Printf(\"linear raw response: %s\", data)\n\treturn nil, fmt.Errorf(\"failed to parse update project response: %w\", err)\n}","preventionTips":["Log raw response bodies on parse failure for diagnosability.","Verify the endpoint URL is the official Linear GraphQL API.","Check proxy/gateway configurations that might inject HTML error pages.","Keep the client library updated against Linear API schema changes.","Assert Content-Type is application/json before unmarshaling."],"tags":["linear","json","unmarshal","schema"],"backgroundTag":"json-unmarshal-error","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}