gastownhall/beads · warning

repository not found: %s

Error message

repository not found: %s

What it means

RemoveRepo scans repos.additional for the requested path and returns "repository not found: <path>" if no entry matches. Exact string comparison is used; there is no path normalization, so a differently formatted path will not match even if it refers to the same directory.

Source

Thrown at internal/config/repos.go:243

func RemoveRepo(configPath, repoPath string) error {
	repos, err := GetReposFromYAML(configPath)
	if err != nil {
		return fmt.Errorf("failed to get repos config: %w", err)
	}

	// Find and remove the repo
	found := false
	newAdditional := make([]string, 0, len(repos.Additional))
	for _, existing := range repos.Additional {
		if existing == repoPath {
			found = true
			continue
		}
		newAdditional = append(newAdditional, existing)
	}

	if !found {
		return fmt.Errorf("repository not found: %s", repoPath)
	}

	repos.Additional = newAdditional

	// If no repos left, clear primary too
	if len(repos.Additional) == 0 {
		repos.Primary = ""
	}

	return SetReposInYAML(configPath, repos)
}

// ListRepos returns the current repos configuration from YAML
func ListRepos(configPath string) (*ReposConfig, error) {
	return GetReposFromYAML(configPath)
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. List current entries (`bd repo list` or read config.yaml) and pass the exact stored string
  2. Normalize the path (filepath.Abs + filepath.Clean) before calling and store it that way
  3. Treat not-found as success if your goal is an idempotent remove
  4. If the repo is the primary ("."), RemoveRepo only manages repos.additional — check the primary field

Example fix

// before
RemoveRepo(cfg, "~/proj") // not found: stored as /home/user/proj
// after
abs, _ := filepath.Abs("~/proj")
abs = filepath.Clean(abs)
RemoveRepo(cfg, abs)
Defensive patterns

Strategy: validation

Validate before calling

repos, err := GetReposFromYAML(configPath)
if err != nil {
    return err
}
if !slices.Contains(repos.Additional, repoPath) {
    return nil // nothing to remove
}

Try / catch

if err := RemoveRepo(cfgPath, repoPath); err != nil {
    if strings.Contains(err.Error(), "not found") {
        return nil // idempotent remove
    }
    return err
}

Prevention

When it happens

Trigger: RemoveRepo(configPath, repoPath) is called with a path string that does not appear verbatim in repos.additional — e.g. it was never added, or it differs by trailing slash, relative vs absolute form, or casing.

Common situations: Repo was added as "/home/user/proj" but removed as "~/proj" or "./proj"; repo was already removed; repo lives in the primary (".") section, not additional.

Related errors


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