gastownhall/beads · error
database not available
Error message
database not available
What it means
saveNotionTargetConfigWithWriter persists notion.data_source_id (and view URL) through a config setter. In proxied-server mode the setter is resolved from the storage backend; if the store is missing or does not implement the notionConfigSetter interface, setter is nil and bd cannot persist the target, so it fails with 'database not available' rather than silently dropping the config.
Source
Thrown at cmd/bd/notion.go:709
result.DatabaseID = strings.TrimSpace(resolved.Database.ID)
}
if err := saveNotionTargetConfigWithWriter(ctx, setter, deleter, result.DataSourceID, result.ViewURL); err != nil {
return notionSetupResult{}, err
}
return result, nil
}
func notionConfigDeleteTarget() notionConfigDeleter {
if store == nil {
return nil
}
deleter, _ := storage.UnwrapStore(store).(notionConfigDeleter)
return deleter
}
func saveNotionTargetConfigWithWriter(ctx context.Context, setter notionConfigSetter, deleter notionConfigDeleter, dataSourceID, viewURL string) error {
if setter == nil {
return fmt.Errorf("database not available")
}
if err := setter.SetConfig(ctx, "notion.data_source_id", strings.TrimSpace(dataSourceID)); err != nil {
return fmt.Errorf("save notion.data_source_id: %w", err)
}
viewURL = strings.TrimSpace(viewURL)
if viewURL == "" {
if deleter == nil {
return fmt.Errorf("store does not support config deletion")
}
if err := deleter.DeleteConfig(ctx, "notion.view_url"); err != nil {
return fmt.Errorf("clear notion.view_url: %w", err)
}
return nil
}
if err := setter.SetConfig(ctx, "notion.view_url", viewURL); err != nil {
return fmt.Errorf("save notion.view_url: %w", err)
}
return nilView on GitHub (pinned to 71377f2769)
Solutions
- Initialize the beads database in the workspace first (`bd init`) and re-run the notion command.
- Ensure the proxied server is running with its database attached, then retry.
- Run the command in the repository root where the .beads database exists.
- If embedding, pass a store that implements the config SetConfig/Deleter capability.
Defensive patterns
Strategy: validation
Validate before calling
// Ensure a beads database exists before notion setup
if _, err := os.Stat(".beads"); err != nil {
return errors.New("run `bd init` in this workspace before bd notion init/connect")
} Try / catch
if err := runNotionConnect(cmd, args); err != nil {
if strings.Contains(err.Error(), "database not available") {
// initialize/open the database or attach it to the proxied server, then retry
}
return err
} Prevention
- Run `bd init` before any notion setup in a fresh workspace
- Execute notion commands from the repository root, not a subdirectory or bare environment
- In proxied-server mode, verify the server has its database attached
- When embedding, supply a store implementing the config setter/deleter capability
When it happens
Trigger: Called from runNotionInitAfterValidation or runNotionConnectAfterValidation (or an inline closure) when the storage.UnwrapStore(store) result is nil or doesn't implement SetConfig, so no setter could be constructed.
Common situations: Running notion init/connect without an open/local database (e.g. outside a beads-initialized repo); proxied-server mode where the backing database isn't attached; embedded usage passing a store that doesn't implement the config-setter capability.
Related errors
- save notion.data_source_id: %w
- clear notion.view_url: %w
- save notion.view_url: %w
- Notion authentication is not configured. Set notion.token wi
- notion.data_source_id is not configured. Run 'bd notion init
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/74848a619f16d36b.
Report an issue: GitHub.