gastownhall/beads · error

ResolveProxiedInit: read config: %w

Error message

ResolveProxiedInit: read config: %w

What it means

ResolveProxiedInit reads the beads config file (fsRepo.ReadBeadsConfig) to resolve the Dolt database name and project ID. When reading that config fails — missing file when required, unreadable, or malformed — the error is wrapped with this prefix and returned. Initialization cannot proceed without the config.

Source

Thrown at internal/storage/domain/beads.go:142

}

var _ BeadsDirFSUseCase = (*beadsDirFSUseCaseImpl)(nil)

func (u *beadsDirFSUseCaseImpl) ResolveBeadsDir(ctx context.Context) BeadsDirResolution {
	return u.fsRepo.ResolveBeadsDirPath(ctx)
}

func (u *beadsDirFSUseCaseImpl) ResolveProxiedInit(ctx context.Context, params ResolveProxiedInitParams) (ResolveProxiedInitResult, error) {
	resolution := u.fsRepo.ResolveBeadsDirPath(ctx)
	result := ResolveProxiedInitResult{
		BeadsDir:    resolution.BeadsDir,
		HasExplicit: resolution.HasExplicit,
		IsLocal:     u.fsRepo.BeadsDirIsLocal(ctx),
	}

	cfg, err := u.fsRepo.ReadBeadsConfig(ctx)
	if err != nil {
		return ResolveProxiedInitResult{}, fmt.Errorf("ResolveProxiedInit: read config: %w", err)
	}

	result.DBName, result.DBNameDerived = resolveDoltDatabaseName(cfg, params.Prefix, params.DBFlag)
	result.ProjectID = resolveProjectID(cfg)
	return result, nil
}

func resolveDoltDatabaseName(cfg *configfile.Config, prefix, dbFlag string) (name string, derived bool) {
	if dbFlag != "" {
		return dbFlag, false
	}
	if cfg != nil && cfg.DoltDatabase != "" {
		return cfg.DoltDatabase, false
	}
	if prefix != "" {
		return strings.ReplaceAll(prefix, "-", "_"), true
	}
	return configfile.DefaultDoltDatabase, true

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped inner error to identify the exact cause (not-found vs parse vs permission).
  2. Verify the beads config file exists at the expected location and re-run beads init if the workspace was never initialized.
  3. If the config exists, validate its syntax — fix corruption or merge-conflict markers, or restore it from git.
  4. Check file permissions on the config and its parent directories.

Example fix

// before: running in a dir with no/corrupt config
result, err := u.ResolveProxiedInit(ctx, params) // ResolveProxiedInit: read config: open .beads/config.yaml: no such file
// after
if _, statErr := os.Stat(configPath); os.IsNotExist(statErr) {
    return fmt.Errorf("not a beads workspace; run 'bd init' first")
}
result, err := u.ResolveProxiedInit(ctx, params)
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(configPath); err != nil {
    return fmt.Errorf("beads config not found at %s; run 'bd init': %w", configPath, err)
}
result, err := useCase.ResolveProxiedInit(ctx, params)

Try / catch

result, err := useCase.ResolveProxiedInit(ctx, params)
if err != nil {
    if strings.Contains(err.Error(), "read config") {
        if errors.Is(err, fs.ErrNotExist) { /* re-init workspace */ }
        if errors.Is(err, fs.ErrPermission) { /* fix permissions */ }
    }
    return err
}

Prevention

When it happens

Trigger: Calling ResolveProxiedInit in a directory where ReadBeadsConfig fails: the beads config file is absent, lacks read permissions, is corrupt/invalid YAML/JSON, or the filesystem access errors (e.g. network mount down).

Common situations: Running an init/resolve command outside an initialized beads workspace; config file deleted or partially written; permission changes after checkout; config syntax broken by a manual edit or merge conflict.

Related errors


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