{"record":{"id":"9fcb2b5aac04f435","repo":"gastownhall/beads","slug":"server-newdoltserver-failed-to-determine-absolut-9fcb2b","errorCode":null,"errorMessage":"server: NewDoltServer: failed to determine absolute path of configPath","messagePattern":"server: NewDoltServer: failed to determine absolute path of configPath","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dbproxy/server/doltserver.go","lineNumber":83,"sourceCode":"\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\")\n\t}\n\tcfg, err := servercfg.YamlConfigFromFile(filesys.LocalFS, configPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"server: NewDoltServer: parse config %q: %w\", configPath, err)\n\t}\n\tvar logFile *os.File\n\tif logFilePath != \"\" {\n\t\tabsLogFilePath, err := filepath.Abs(logFilePath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"server: NewDoltServer: failed to determine absolute path of logFilePath\")\n\t\t}\n\t\tlogFile, err = os.OpenFile(absLogFilePath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o600) //nolint:gosec // logFilePath is caller-derived, not user-request input\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"server: NewDoltServer: open log %q: %w\", logFilePath, err)\n\t\t}\n\t}\n\tif keepAlivePeriod == 0 {\n\t\tkeepAlivePeriod = defaultKeepAlivePeriod","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/server/doltserver.go#L65-L101","documentation":"NewDoltServer resolves configPath (the dolt sql-server YAML config) to an absolute path before parsing it and passing it to the child process. filepath.Abs fails only when the process cwd cannot be determined (deleted cwd or getwd failure) and configPath was relative.","triggerScenarios":"Calling NewDoltServer with a relative configPath (e.g. \".beads/server.yaml\") after the process working directory has been deleted or getwd fails. Note the very next step parses the config from the original relative path, so an unreadable file surfaces as a different 'parse config' error instead.","commonSituations":"Long-running processes whose cwd was removed (tmp cleanup, CI teardown); launching from a shell in a directory that was subsequently deleted; chroot/container setups with erased working directories.","solutions":["Pass an absolute configPath, resolved at process startup while the cwd is valid","Check whether the process cwd is deleted (ls /proc/<pid>/cwd) and restart from a valid directory if so","Recreate the deleted working directory, then retry the operation"],"exampleFix":"// before\nsrv, err := server.NewDoltServer(bin, root, \".beads/server.yaml\", logPath, 0, db)\n// after\nabsCfg, err := filepath.Abs(\".beads/server.yaml\")\nif err != nil { return err }\nsrv, err := server.NewDoltServer(bin, root, absCfg, logPath, 0, db)","handlingStrategy":"validation","validationCode":"cfg, err := filepath.Abs(configPath)\nif err != nil { return fmt.Errorf(\"cannot resolve config path (cwd invalid?): %w\", err) }\nif _, err := os.Stat(cfg); err != nil { return fmt.Errorf(\"server config not found at %s: %w\", cfg, err) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve configPath to absolute at startup and pass the absolute value everywhere","Check config file existence before calling NewDoltServer to get a clearer error","Avoid launching services from ephemeral directories subject to cleanup"],"tags":["go","filesystem","server-startup","path-resolution"],"backgroundTag":"cwd-unresolvable-path","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}