{"record":{"id":"7ae1484d74b2a21b","repo":"gastownhall/beads","slug":"save-notion-view-url-w","errorCode":null,"errorMessage":"save notion.view_url: %w","messagePattern":"save notion\\.view_url: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/notion.go","lineNumber":725,"sourceCode":"func saveNotionTargetConfigWithWriter(ctx context.Context, setter notionConfigSetter, deleter notionConfigDeleter, dataSourceID, viewURL string) error {\n\tif setter == nil {\n\t\treturn fmt.Errorf(\"database not available\")\n\t}\n\tif err := setter.SetConfig(ctx, \"notion.data_source_id\", strings.TrimSpace(dataSourceID)); err != nil {\n\t\treturn fmt.Errorf(\"save notion.data_source_id: %w\", err)\n\t}\n\tviewURL = strings.TrimSpace(viewURL)\n\tif viewURL == \"\" {\n\t\tif deleter == nil {\n\t\t\treturn fmt.Errorf(\"store does not support config deletion\")\n\t\t}\n\t\tif err := deleter.DeleteConfig(ctx, \"notion.view_url\"); err != nil {\n\t\t\treturn fmt.Errorf(\"clear notion.view_url: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := setter.SetConfig(ctx, \"notion.view_url\", viewURL); err != nil {\n\t\treturn fmt.Errorf(\"save notion.view_url: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc writeNotionJSON(cmd *cobra.Command, value interface{}) error {\n\tencoder := json.NewEncoder(cmd.OutOrStdout())\n\tencoder.SetIndent(\"\", \"  \")\n\treturn encoder.Encode(value)\n}\n\nfunc firstNonEmpty(values ...string) string {\n\tfor _, value := range values {\n\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\treturn strings.TrimSpace(value)\n\t\t}\n\t}\n\treturn \"\"\n}","sourceCodeStart":707,"sourceCodeEnd":743,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/notion.go#L707-L743","documentation":"After handling the empty-URL case, saveNotionTargetConfigWithWriter saves the trimmed view URL via setter.SetConfig(ctx, \"notion.view_url\", viewURL). A storage write failure is wrapped as 'save notion.view_url: %w', meaning the Notion view URL was not persisted.","triggerScenarios":"setter.SetConfig(ctx, \"notion.view_url\", ...) fails during bd notion init/connect when a non-empty view URL is provided — same storage failure modes as the data_source_id save (store closed, DB error, permissions).","commonSituations":"Configuring the Notion view URL against a Dolt DB that is down, locked by another process, or on a full/read-only disk.","solutions":["Check the wrapped cause for the storage error and address it (start Dolt, fix permissions).","Run 'bd doctor' to verify the database is healthy before retrying.","Free disk space / fix read-only mounts under .beads.","Retry bd notion init/connect once the store is writable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if store == nil {\n    return errors.New(\"database not available\")\n}\nif err := setter.SetConfig(ctx, \"notion.data_source_id\", probeKey); err != nil {\n    return fmt.Errorf(\"store not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := saveNotionTargetConfigWithWriter(ctx, setter, deleter, dsID, viewURL); err != nil {\n    if strings.Contains(err.Error(), \"save notion.view_url\") {\n        // check wrapped cause: DB down, permissions, disk full\n    }\n    return err\n}","preventionTips":["Verify store health (bd doctor) before configuring Notion","Check disk space and .beads write permissions","Close out competing bd processes before writes","Retry after fixing the underlying storage error"],"tags":["go","config","notion","storage"],"backgroundTag":"config-save-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}