{"record":{"id":"f505e51883c05742","repo":"gastownhall/beads","slug":"notion-data-source-id-is-not-configured-run-bd-n","errorCode":null,"errorMessage":"notion.data_source_id is not configured. Run 'bd notion init --parent <page-id>' or 'bd notion connect --url <notion-url>', or set it directly via bd config set notion.data_source_id <id> or NOTION_DATA_SOURCE_ID","messagePattern":"notion\\.data_source_id is not configured\\. Run 'bd notion init --parent <page-id>' or 'bd notion connect --url <notion-url>', or set it directly via bd config set notion\\.data_source_id <id> or NOTION_DATA_SOURCE_ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/notion.go","lineNumber":211,"sourceCode":"\tif dbPath != \"\" {\n\t\ttempStore, err := openReadOnlyStoreForDBPath(ctx, dbPath)\n\t\tif err == nil {\n\t\t\tdefer func() { _ = tempStore.Close() }()\n\t\t\treturn notion.ResolveAuth(ctx, tempStore)\n\t\t}\n\t}\n\tif token := strings.TrimSpace(os.Getenv(\"NOTION_TOKEN\")); token != \"\" {\n\t\treturn &notion.ResolvedAuth{Token: token, Source: notion.AuthSourceEnv}, nil\n\t}\n\treturn nil, nil\n}\n\nfunc validateNotionConfig(cfg notionConfig, auth *notion.ResolvedAuth) error {\n\tif auth == nil || strings.TrimSpace(auth.Token) == \"\" {\n\t\treturn fmt.Errorf(\"Notion authentication is not configured. Set notion.token with 'bd config set notion.token <token>', or export NOTION_TOKEN\")\n\t}\n\tif cfg.DataSourceID == \"\" {\n\t\treturn fmt.Errorf(\"notion.data_source_id is not configured. Run 'bd notion init --parent <page-id>' or 'bd notion connect --url <notion-url>', or set it directly via bd config set notion.data_source_id <id> or NOTION_DATA_SOURCE_ID\")\n\t}\n\treturn nil\n}\n\nfunc validateNotionToken(auth *notion.ResolvedAuth) error {\n\tif auth == nil || strings.TrimSpace(auth.Token) == \"\" {\n\t\treturn fmt.Errorf(\"Notion authentication is not configured. Set notion.token with 'bd config set notion.token <token>', or export NOTION_TOKEN\")\n\t}\n\treturn nil\n}\n\nfunc maskNotionAuth(auth *notion.ResolvedAuth) string {\n\tif auth == nil || strings.TrimSpace(auth.Token) == \"\" {\n\t\treturn \"(not set)\"\n\t}\n\ttoken := auth.Token\n\tif len(token) <= 4 {\n\t\treturn \"****\"","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/notion.go#L193-L229","documentation":"After auth passes, validateNotionConfig requires the configured Notion data source ID — the database table bd syncs with. Without it, sync commands cannot know where to write. The error lists every remediation path: `bd notion init`, `bd notion connect`, direct config, or the NOTION_DATA_SOURCE_ID env var.","triggerScenarios":"Running `bd notion status|sync|push|pull` with a valid token but notion.data_source_id empty in bd config and NOTION_DATA_SOURCE_ID unset — i.e., init/connect was never run or the config was wiped.","commonSituations":"Token configured but init step skipped; switching machines where only the token was exported via env; config database reset; data source deleted in Notion and config cleaned.","solutions":["Run `bd notion init --parent <page-id>` to create and configure a new database.","Or run `bd notion connect --url <notion-url>` to attach an existing database.","Or set it directly: `bd config set notion.data_source_id <id>` or export NOTION_DATA_SOURCE_ID.","Verify with `bd notion status`."],"exampleFix":"// before\nbd notion pull\n// Error: notion.data_source_id is not configured...\n\n// after\nbd notion connect --url https://notion.so/workspace/<db-id>\nbd notion pull","handlingStrategy":"validation","validationCode":"if os.Getenv(\"NOTION_DATA_SOURCE_ID\") == \"\" {\n    if v, _ := exec.Command(\"bd\", \"config\", \"get\", \"notion.data_source_id\").Output(); len(strings.TrimSpace(string(v))) == 0 {\n        return errors.New(\"run `bd notion init --parent <page-id>` or `bd notion connect --url <url>` first\")\n    }\n}","typeGuard":"func hasDataSourceID(cfg notionConfig) bool {\n    return strings.TrimSpace(cfg.DataSourceID) != \"\"\n}","tryCatchPattern":"if err := runNotionSync(cmd, args); err != nil {\n    if strings.Contains(err.Error(), \"data_source_id is not configured\") {\n        // run init/connect automatically or prompt the user\n    }\n    return err\n}","preventionTips":["Complete `bd notion init`/`connect` once per workspace before scripting sync","Persist data_source_id via `bd config set` rather than relying only on env vars","Run `bd notion status` as a preflight in automation","Keep the token and data_source_id configured together when moving machines"],"tags":["go","notion","config","setup"],"backgroundTag":"missing-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}