gastownhall/beads · error

no active beads workspace

Error message

no active beads workspace

What it means

adoptGitOriginAsRemoteForPush adopts the git 'origin' URL as a Dolt remote during `bd dolt push`. If selectedDoltBeadsDir() returns empty — no active .beads workspace for the current directory — it cannot attach the remote and returns this error. It guards against writing config outside a real workspace.

Source

Thrown at cmd/bd/dolt.go:474

		return false, err
	}
	// Deriving the URL comes first and is read-only (`git remote get-url`).
	// Workspace resolution is deliberately NOT done yet: selectedDoltBeadsDir
	// calls prepareSelectedNoDBContext, which mutates process and on-disk
	// workspace state, and nothing may mutate before consent is established.
	originURL, err := gitOriginGetURLForActiveRepo(ctx)
	if err != nil || originURL == "" {
		return false, nil
	}
	remoteURL := normalizeRemoteURL(originURL)

	if proceed, err := applyAdoptionConsent(remoteURL, policy, optIn); err != nil || !proceed {
		return false, err
	}

	beadsDir := selectedDoltBeadsDir()
	if beadsDir == "" {
		return false, fmt.Errorf("no active beads workspace")
	}

	if err := st.AddRemote(ctx, "origin", remoteURL); err != nil {
		return false, err
	}

	if err := config.SetYamlConfigInDir(beadsDir, "sync.remote", remoteURL); err != nil {
		return false, fmt.Errorf("failed to persist sync.remote to config.yaml: %w", err)
	}
	fmt.Fprintln(os.Stderr, "Committing .beads/config.yaml (sync.remote) under your git identity.")
	commitBeadsConfigForActiveRepo(ctx, "bd: update sync.remote")
	return true, nil
}

// printDivergedHistoryGuidance prints recovery guidance when push/pull fails
// due to diverged local and remote histories.
func printDivergedHistoryGuidance(operation string) {
	fmt.Fprintln(os.Stderr, "")

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd init` in the repository to create the .beads workspace
  2. cd to the repository root (where .beads lives) and retry
  3. Restore the missing .beads directory (git checkout / restore .beads/config.yaml) if deleted
  4. Set BD_BEADS_DIR to the correct workspace path if you use a non-standard location
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(filepath.Join(repoRoot, ".beads")); err != nil {
  return fmt.Errorf("no .beads workspace here; run `bd init` first")
}

Try / catch

added, err := adoptGitOriginRemoteForPush(ctx, st, cfg)
if err != nil {
  if err.Error() == "no active beads workspace" {
    // prompt/init workspace then retry push
  }
  return err
}

Prevention

When it happens

Trigger: Running `bd dolt push` (or push flows that call adoptGitOriginRemoteForPush) outside a bd-initialized repository, with a missing .beads directory, or with BD_BEADS_DIR unset and no discoverable workspace.

Common situations: Running the command from a subdirectory before workspace discovery applies, after deleting .beads/, or in CI where the repo wasn't checked out with .beads included.

Related errors


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