{"record":{"id":"1cb5ccd17f2255aa","repo":"gastownhall/beads","slug":"parse-update-page-response-w","errorCode":null,"errorMessage":"parse update page response: %w","messagePattern":"parse update page response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/notion/client.go","lineNumber":176,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar page Page\n\tif err := json.Unmarshal(body, &page); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse create page response: %w\", err)\n\t}\n\treturn &page, nil\n}\n\nfunc (c *Client) UpdatePage(ctx context.Context, pageID string, properties map[string]interface{}) (*Page, error) {\n\trequest := map[string]interface{}{\"properties\": properties}\n\tbody, err := c.doRequest(ctx, http.MethodPatch, \"/pages/\"+url.PathEscape(pageID), request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar page Page\n\tif err := json.Unmarshal(body, &page); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse update page response: %w\", err)\n\t}\n\treturn &page, nil\n}\n\nfunc (c *Client) ArchivePage(ctx context.Context, pageID string, inTrash bool) (*Page, error) {\n\tbody, err := c.doRequest(ctx, http.MethodPatch, \"/pages/\"+url.PathEscape(pageID), map[string]interface{}{\"in_trash\": inTrash})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar page Page\n\tif err := json.Unmarshal(body, &page); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse archive page response: %w\", err)\n\t}\n\treturn &page, nil\n}\n\ntype DataSourceResolver interface {\n\tRetrieveDataSource(ctx context.Context, dataSourceID string) (*DataSource, error)","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/notion/client.go#L158-L194","documentation":"UpdatePage PATCHes /pages/{id} with a properties object and unmarshals the reply into Page; this error wraps unmarshal failure of that reply. It means the PATCH succeeded at the HTTP level but the body could not be decoded into Page.","triggerScenarios":"Calling Client.UpdatePage with properties whose response representation (e.g. newly added property types, changed rich-text or formula value shapes) does not fit the Page struct, or receiving a non-JSON 200 body from an intermediary.","commonSituations":"Updating pages that contain property types the library was never built to decode (Notion adds types over time); API version drift; gateway error pages served with 200.","solutions":["Log the raw response body to identify the offending JSON shape.","Update the notion client library so Page/property types match the current API.","Pin Notion-Version to the version the library targets.","As a workaround, send properties via UpdatePage but read results via QueryDataSource if only query responses decode reliably."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"page, err := client.UpdatePage(ctx, pageID, props)\nif err != nil {\n    if strings.Contains(err.Error(), \"parse update page response\") {\n        // PATCH likely succeeded; re-fetch or tolerate decode failure\n    }\n    return err\n}","preventionTips":["Keep the library's Page/property types current with the API","Avoid pages containing property types the library cannot decode when you need the response object","Pin Notion-Version consistently across calls","Remember PATCH may have succeeded even if decoding failed"],"tags":["notion","json","api","response-parsing"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}