{"record":{"id":"ac3ac114026e1a4e","repo":"gastownhall/beads","slug":"parent-page-id-is-required","errorCode":null,"errorMessage":"parent page ID is required","messagePattern":"parent page ID is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/notion/client.go","lineNumber":91,"sourceCode":"\treturn &ds, nil\n}\n\nfunc (c *Client) RetrieveDatabase(ctx context.Context, databaseID string) (*Database, error) {\n\tbody, err := c.doRequest(ctx, http.MethodGet, \"/databases/\"+url.PathEscape(databaseID), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar db Database\n\tif err := json.Unmarshal(body, &db); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse database response: %w\", err)\n\t}\n\treturn &db, nil\n}\n\nfunc (c *Client) CreateDatabase(ctx context.Context, parentPageID, title string) (*Database, error) {\n\tparentPageID = strings.TrimSpace(parentPageID)\n\tif parentPageID == \"\" {\n\t\treturn nil, fmt.Errorf(\"parent page ID is required\")\n\t}\n\ttitle = strings.TrimSpace(title)\n\tif title == \"\" {\n\t\ttitle = DefaultDatabaseTitle\n\t}\n\trequest := map[string]interface{}{\n\t\t\"parent\": map[string]interface{}{\n\t\t\t\"type\":    \"page_id\",\n\t\t\t\"page_id\": parentPageID,\n\t\t},\n\t\t\"title\":     richTextRequest(title),\n\t\t\"is_inline\": false,\n\t\t\"initial_data_source\": map[string]interface{}{\n\t\t\t\"title\":      richTextRequest(title),\n\t\t\t\"properties\": BuildInitialDataSourceProperties(),\n\t\t},\n\t}\n\tbody, err := c.doRequest(ctx, http.MethodPost, \"/databases\", request)","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/notion/client.go#L73-L109","documentation":"CreateDatabase requires a parent page ID; an empty/whitespace-only value is rejected before any request is made. Notion databases must be created under a parent page.","triggerScenarios":"Calling CreateDatabase(ctx, \"\", title) — e.g. from runNotionInitAfterValidation when the Notion parent page ID was never configured or was blank.","commonSituations":"Missing NOTION_PARENT_PAGE_ID-style config value; config file with empty field; user skipped the init wizard step that collects the parent page.","solutions":["Set the parent page ID in configuration (or pass it explicitly) before calling CreateDatabase.","Run the Notion init/validation flow to capture the parent page ID from the user.","Verify with a validation step (strings.TrimSpace check) before invoking."],"exampleFix":"// before\nclient.CreateDatabase(ctx, cfg.NotionParentPage, \"Beads\")\n// after\nif strings.TrimSpace(cfg.NotionParentPage) == \"\" {\n    return fmt.Errorf(\"configure notion parent page ID first\")\n}\nclient.CreateDatabase(ctx, cfg.NotionParentPage, \"Beads\")","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(parentPageID) == \"\" {\n    return errors.New(\"parent page ID must be configured before creating a database\")\n}","typeGuard":null,"tryCatchPattern":"db, err := client.CreateDatabase(ctx, parentPageID, title)\nif err != nil {\n    if err.Error() == \"parent page ID is required\" {\n        return fmt.Errorf(\"run notion init to set the parent page\")\n    }\n    return err\n}","preventionTips":["Validate Notion config (token + parent page) during init","Fail fast on empty required config fields","Document required env/config keys"],"tags":["notion","validation","config"],"backgroundTag":"missing-required-parameter","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}