gastownhall/beads · error

save notion.view_url: %w

Error message

save notion.view_url: %w

What it means

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.

Source

Thrown at cmd/bd/notion.go:725

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 nil
}

func writeNotionJSON(cmd *cobra.Command, value interface{}) error {
	encoder := json.NewEncoder(cmd.OutOrStdout())
	encoder.SetIndent("", "  ")
	return encoder.Encode(value)
}

func firstNonEmpty(values ...string) string {
	for _, value := range values {
		if strings.TrimSpace(value) != "" {
			return strings.TrimSpace(value)
		}
	}
	return ""
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the wrapped cause for the storage error and address it (start Dolt, fix permissions).
  2. Run 'bd doctor' to verify the database is healthy before retrying.
  3. Free disk space / fix read-only mounts under .beads.
  4. Retry bd notion init/connect once the store is writable.
Defensive patterns

Strategy: try-catch

Validate before calling

if store == nil {
    return errors.New("database not available")
}
if err := setter.SetConfig(ctx, "notion.data_source_id", probeKey); err != nil {
    return fmt.Errorf("store not writable: %w", err)
}

Try / catch

if err := saveNotionTargetConfigWithWriter(ctx, setter, deleter, dsID, viewURL); err != nil {
    if strings.Contains(err.Error(), "save notion.view_url") {
        // check wrapped cause: DB down, permissions, disk full
    }
    return err
}

Prevention

When it happens

Trigger: 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).

Common situations: Configuring the Notion view URL against a Dolt DB that is down, locked by another process, or on a full/read-only disk.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/7ae1484d74b2a21b. Report an issue: GitHub.