{"record":{"id":"971e5594384e54a1","repo":"gastownhall/beads","slug":"initializing-notion-tracker-w","errorCode":null,"errorMessage":"initializing Notion tracker: %w","messagePattern":"initializing Notion tracker: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/sync_push_pull.go","lineNumber":857,"sourceCode":"\t\tCheckReadonly(\"notion push\")\n\t}\n\n\tcfg := getNotionConfig()\n\tauth, err := resolveNotionAuth(cmd.Context())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := validateNotionConfig(cfg, auth); err != nil {\n\t\treturn err\n\t}\n\tif err := ensureStoreActive(); err != nil {\n\t\treturn fmt.Errorf(\"database not available: %w\", err)\n\t}\n\n\tctx := cmd.Context()\n\tnt := &notion.Tracker{}\n\tif err := nt.Init(ctx, store); err != nil {\n\t\treturn fmt.Errorf(\"initializing Notion tracker: %w\", err)\n\t}\n\n\tengine := tracker.NewEngine(nt, store, actor)\n\tunsupportedStats := newNotionUnsupportedPushStats()\n\tengine.PushHooks = buildNotionPushHooks(ctx, nt, unsupportedStats)\n\tengine.OnMessage = func(msg string) { fmt.Println(\"  \" + msg) }\n\tengine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, \"Warning: %s\\n\", msg) }\n\n\tresult, syncErr := engine.Sync(ctx, tracker.SyncOptions{\n\t\tPush:             true,\n\t\tPull:             false,\n\t\tDryRun:           dryRun,\n\t\tExcludeEphemeral: true,\n\t\tIssueIDs:         args,\n\t})\n\tif syncErr != nil {\n\t\treturn syncErr\n\t}","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/sync_push_pull.go#L839-L875","documentation":"This wraps any failure from notion.Tracker.Init during `bd notion push`. Init validates the Notion integration (token, database/page config) and prepares the tracker against the store. A failure here means the Notion tracker could not be set up and the push aborts.","triggerScenarios":"Running `bd notion push <id>` when notion.Tracker.Init(ctx, store) fails — missing/invalid NOTION_TOKEN, no Notion database configured, integration not shared with the target database, or API connectivity failure.","commonSituations":"Notion integration secret expired or revoked; the internal integration was never granted access to the target Notion database in Notion's UI; wrong database ID in config; network/proxy blocking api.notion.com.","solutions":["Verify NOTION_TOKEN (or configured secret) is set and belongs to a valid internal integration","In Notion, open the target database → Connections → add your integration","Check the configured Notion database ID and workspace mapping in the beads Notion config","Test connectivity: curl -H \"Authorization: Bearer $NOTION_TOKEN\" https://api.notion.com/v1/users/me","Read the wrapped cause after this message for the specific Notion API failure"],"exampleFix":"// before\nbd notion push bd-42\n// Error: initializing Notion tracker: ... code: unauthorized\n// after\nexport NOTION_TOKEN=\"secret_...\"  # valid integration secret, shared with the DB\nbd notion push bd-42","handlingStrategy":"validation","validationCode":"if [ -z \"$NOTION_TOKEN\" ]; then echo \"NOTION_TOKEN not set\" >&2; exit 1; fi\ncurl -fsS -H \"Authorization: Bearer $NOTION_TOKEN\" -H \"Notion-Version: 2022-06-28\" https://api.notion.com/v1/users/me > /dev/null || { echo \"Notion token invalid\" >&2; exit 1; }\nbd notion push bd-42","typeGuard":null,"tryCatchPattern":"if err := nt.Init(ctx, store); err != nil {\n    var apiErr *notion.APIError\n    if errors.As(err, &apiErr) && apiErr.Code == \"unauthorized\" {\n        return fmt.Errorf(\"Notion token rejected; re-share database with integration and refresh token\")\n    }\n    return fmt.Errorf(\"initializing Notion tracker: %w\", err)\n}","preventionTips":["Share every target Notion database with the integration in Notion's Connections UI","Rotate and re-export NOTION_TOKEN on a schedule; update CI secrets together","Verify network/proxy access to api.notion.com from the environment running bd"],"tags":["notion","sync","tracker-init","cli"],"backgroundTag":"tracker-init-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}