gastownhall/beads · error

server: NewDoltServer: configPath is required

Error message

server: NewDoltServer: configPath is required

What it means

NewDoltServer requires a non-empty configPath pointing at the Dolt server configuration (yaml) file. The backend is launched with this config; without it the server cannot be started, so the constructor rejects empty values up front.

Source

Thrown at internal/storage/dbproxy/server/doltserver.go:71

	logFile *os.File
	eg      *errgroup.Group
	egCtx   context.Context
	cancel  context.CancelFunc
	pid     int
}

var _ DatabaseServer = (*DoltServer)(nil)

func NewDoltServer(doltBinExec, rootDir, configPath, logFilePath string, keepAlivePeriod time.Duration, database string) (*DoltServer, error) {
	if doltBinExec == "" {
		return nil, errors.New("server: NewDoltServer: doltBinExec is required")
	}
	if rootDir == "" {
		return nil, errors.New("server: NewDoltServer: rootDir is required")
	}
	if configPath == "" {
		return nil, errors.New("server: NewDoltServer: configPath is required")
	}
	absDoltBinExec, err := filepath.Abs(doltBinExec)
	if err != nil {
		return nil, errors.New("server: NewDoltServer: failed to determine absolute path of doltBinExec")
	}
	absRootDir, err := filepath.Abs(rootDir)
	if err != nil {
		return nil, errors.New("server: NewDoltServer: failed to determine absolute path of rootDir")
	}
	absConfigPath, err := filepath.Abs(configPath)
	if err != nil {
		return nil, errors.New("server: NewDoltServer: failed to determine absolute path of configPath")
	}
	cfg, err := servercfg.YamlConfigFromFile(filesys.LocalFS, configPath)
	if err != nil {
		return nil, fmt.Errorf("server: NewDoltServer: parse config %q: %w", configPath, err)
	}
	var logFile *os.File

View on GitHub (pinned to 71377f2769)

Solutions

  1. Generate/write the Dolt server config file in the workspace before constructing the server
  2. Pass the correct path to the existing dolt_server.yaml/config file
  3. Re-initialize the workspace so required metadata files are created

Example fix

// before
srv, err := server.NewDoltServer(bin, root, "", logPath, ka, db)
// after
cfgPath := filepath.Join(root, ".beads", "dolt_server.yaml")
if err := ensureDoltServerConfig(cfgPath); err != nil { return err }
srv, err := server.NewDoltServer(bin, root, cfgPath, logPath, ka, db)
Defensive patterns

Strategy: validation

Validate before calling

if configPath == "" {
    configPath = filepath.Join(rootDir, ".beads", "dolt_server.yaml")
}
if _, err := os.Stat(configPath); err != nil {
    return fmt.Errorf("server config missing: %w", err)
}

Try / catch

srv, err := server.NewDoltServer(doltBin, rootDir, configPath, logPath, ka, db)
if err != nil && strings.Contains(err.Error(), "configPath is required") {
    return fmt.Errorf("server config file path not set; re-initialize workspace: %w", err)
}

Prevention

When it happens

Trigger: Calling server.NewDoltServer with an empty configPath — config file path never generated or not persisted in the workspace.

Common situations: First run where config generation step was skipped; corrupted workspace metadata; callers constructing the server directly without the normal startup pipeline that writes the config file.

Related errors


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