gastownhall/beads · error
parse update page response: %w
Error message
parse update page response: %w
What it means
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.
Source
Thrown at internal/notion/client.go:176
if err != nil {
return nil, err
}
var page Page
if err := json.Unmarshal(body, &page); err != nil {
return nil, fmt.Errorf("parse create page response: %w", err)
}
return &page, nil
}
func (c *Client) UpdatePage(ctx context.Context, pageID string, properties map[string]interface{}) (*Page, error) {
request := map[string]interface{}{"properties": properties}
body, err := c.doRequest(ctx, http.MethodPatch, "/pages/"+url.PathEscape(pageID), request)
if err != nil {
return nil, err
}
var page Page
if err := json.Unmarshal(body, &page); err != nil {
return nil, fmt.Errorf("parse update page response: %w", err)
}
return &page, nil
}
func (c *Client) ArchivePage(ctx context.Context, pageID string, inTrash bool) (*Page, error) {
body, err := c.doRequest(ctx, http.MethodPatch, "/pages/"+url.PathEscape(pageID), map[string]interface{}{"in_trash": inTrash})
if err != nil {
return nil, err
}
var page Page
if err := json.Unmarshal(body, &page); err != nil {
return nil, fmt.Errorf("parse archive page response: %w", err)
}
return &page, nil
}
type DataSourceResolver interface {
RetrieveDataSource(ctx context.Context, dataSourceID string) (*DataSource, error)View on GitHub (pinned to 71377f2769)
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.
Defensive patterns
Strategy: try-catch
Try / catch
page, err := client.UpdatePage(ctx, pageID, props)
if err != nil {
if strings.Contains(err.Error(), "parse update page response") {
// PATCH likely succeeded; re-fetch or tolerate decode failure
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- parse data source query response: %w
- parse create page response: %w
- parse archive page response: %w
- parse current user response: %w
- parse data source response: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/1cb5ccd17f2255aa.
Report an issue: GitHub.