{"record":{"id":"4afbc1037ed33dcd","repo":"gastownhall/beads","slug":"server-newdoltserver-doltbinexec-is-required","errorCode":null,"errorMessage":"server: NewDoltServer: doltBinExec is required","messagePattern":"server: NewDoltServer: doltBinExec is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dbproxy/server/doltserver.go","lineNumber":65,"sourceCode":"\tdoltBinExec     string\n\trootDir         string\n\tconfigPath      string\n\tdatabase        string\n\tconfig          servercfg.ServerConfig\n\tkeepAlivePeriod time.Duration\n\n\tlogFile *os.File\n\teg      *errgroup.Group\n\tegCtx   context.Context\n\tcancel  context.CancelFunc\n\tpid     int\n}\n\nvar _ DatabaseServer = (*DoltServer)(nil)\n\nfunc NewDoltServer(doltBinExec, rootDir, configPath, logFilePath string, keepAlivePeriod time.Duration, database string) (*DoltServer, error) {\n\tif doltBinExec == \"\" {\n\t\treturn nil, errors.New(\"server: NewDoltServer: doltBinExec is required\")\n\t}\n\tif rootDir == \"\" {\n\t\treturn nil, errors.New(\"server: NewDoltServer: rootDir is required\")\n\t}\n\tif configPath == \"\" {\n\t\treturn nil, errors.New(\"server: NewDoltServer: configPath is required\")\n\t}\n\tabsDoltBinExec, err := filepath.Abs(doltBinExec)\n\tif err != nil {\n\t\treturn nil, errors.New(\"server: NewDoltServer: failed to determine absolute path of doltBinExec\")\n\t}\n\tabsRootDir, err := filepath.Abs(rootDir)\n\tif err != nil {\n\t\treturn nil, errors.New(\"server: NewDoltServer: failed to determine absolute path of rootDir\")\n\t}\n\tabsConfigPath, err := filepath.Abs(configPath)\n\tif err != nil {\n\t\treturn nil, errors.New(\"server: NewDoltServer: failed to determine absolute path of configPath\")","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/server/doltserver.go#L47-L83","documentation":"NewDoltServer validates its required parameters and returns this error when doltBinExec is empty. The server needs the path to the dolt binary to spawn the backend; without it there is nothing to exec.","triggerScenarios":"Calling server.NewDoltServer(\"\", ...) with an unset or empty dolt binary path variable.","commonSituations":"Missing DOLT_BIN environment variable or config key; config struct zero-valued because it was never populated; constructor called in tests without fixtures.","solutions":["Set the dolt binary path from config or env (e.g. DOLT_BIN) before constructing the server","Default to a known installed path (e.g. from PATH lookup via exec.LookPath(\"dolt\"))","Validate configuration at load time so empty binary paths fail early"],"exampleFix":"// before\nsrv, err := server.NewDoltServer(cfg.DoltBin, root, cfgPath, logPath, ka, db) // cfg.DoltBin == \"\"\n// after\ndoltBin := cfg.DoltBin\nif doltBin == \"\" {\n    doltBin, err = exec.LookPath(\"dolt\")\n}\nsrv, err := server.NewDoltServer(doltBin, root, cfgPath, logPath, ka, db)","handlingStrategy":"validation","validationCode":"if doltBin == \"\" {\n    p, err := exec.LookPath(\"dolt\")\n    if err != nil { return fmt.Errorf(\"dolt binary not configured or on PATH: %w\", err) }\n    doltBin = p\n}","typeGuard":null,"tryCatchPattern":"srv, err := server.NewDoltServer(doltBin, root, cfgPath, logPath, ka, db)\nif err != nil && strings.Contains(err.Error(), \"doltBinExec is required\") {\n    return fmt.Errorf(\"set DOLT_BIN or install dolt on PATH: %w\", err)\n}","preventionTips":["Resolve the dolt binary path (env/config/PATH) before server construction","Fail fast at config load if the binary path is empty","Keep tests providing a fixture binary path"],"tags":["go","config","validation"],"backgroundTag":"missing-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}