{"record":{"id":"e50291a36cabf44c","repo":"gastownhall/beads","slug":"uow-resolving-server-root-dir-w","errorCode":null,"errorMessage":"uow: resolving server root dir: %w","messagePattern":"uow: resolving server root dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/doltserver_provider.go","lineNumber":50,"sourceCode":"\tif idleTimeout == 0 {\n\t\tidleTimeout = defaultProxyIdleTimeout\n\t}\n\tif database == \"\" {\n\t\treturn nil, fmt.Errorf(\"uow: database name must not be empty (caller should default to %q)\", \"beads\")\n\t}\n\tif err := backend.Validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: backend: %w\", err)\n\t}\n\tif rootUser == \"\" {\n\t\treturn nil, fmt.Errorf(\"uow: rootUser must not be empty\")\n\t}\n\tif doltBinExec == \"\" {\n\t\treturn nil, fmt.Errorf(\"uow: doltBinExec must not be empty\")\n\t}\n\n\tabsServerRootDir, err := filepath.Abs(serverRootDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: resolving server root dir: %w\", err)\n\t}\n\tabsDoltBinExec, err := filepath.Abs(doltBinExec)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: resolving dolt bin exec: %w\", err)\n\t}\n\n\tif err := os.MkdirAll(absServerRootDir, config.BeadsDirPerm); err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: creating server root directory: %w\", err)\n\t}\n\n\tep, err := proxy.GetCreateDatabaseProxyServerEndpoint(absServerRootDir, proxy.OpenOpts{\n\t\tBackend:        backend,\n\t\tConfigFilePath: serverConfigFilePath,\n\t\tLogFilePath:    serverLogFilePath,\n\t\tDoltBinPath:    absDoltBinExec,\n\t\tDatabase:       database,\n\t\tIdleTimeout:    idleTimeout,\n\t\tPort:           proxyPort,","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/doltserver_provider.go#L32-L68","documentation":"filepath.Abs failed while converting serverRootDir to an absolute path. filepath.Abs only fails when getting the current working directory fails, which means the process has no readable working directory (e.g. it was deleted). The OS error is wrapped for detail.","triggerScenarios":"Calling NewDoltServerUOWProvider with a relative serverRootDir while os.Getwd() fails — the cwd was removed, or permission to read it was revoked.","commonSituations":"Daemon started in a directory that was later deleted; running from a container/privileged context where cwd is inaccessible; symlinked cwd cleaned up by a tmpfiles sweeper.","solutions":["Pass an absolute serverRootDir so filepath.Abs is a no-op","Recreate or cd back to a valid working directory before starting","Restore read/execute permission on the current directory"],"exampleFix":"// before\nprov, err := NewDoltServerUOWProvider(ctx, \"beads-data\", ...)\n// after\nrootDir, err := filepath.Abs(\"beads-data\") // or use an absolute path from config\nif err != nil { return err }\nprov, err := NewDoltServerUOWProvider(ctx, rootDir, ...)","handlingStrategy":"validation","validationCode":"if !filepath.IsAbs(serverRootDir) {\n    abs, err := filepath.Abs(serverRootDir)\n    if err != nil { return fmt.Errorf(\"cannot resolve server root dir (cwd unreadable?): %w\", err) }\n    serverRootDir = abs\n}","typeGuard":"func isUsableAbsPath(p string) bool {\n    abs, err := filepath.Abs(p)\n    return err == nil && abs != \"\"\n}","tryCatchPattern":"prov, err := NewDoltServerUOWProvider(...)\nif err != nil && strings.Contains(err.Error(), \"resolving server root dir\") {\n    // cwd is broken: switch to an absolute configured path and retry\n    os.Chdir(\"/\")\n    prov, err = NewDoltServerUOWProvider(...)\n}","preventionTips":["Always pass absolute paths from config rather than relative ones","For daemons, resolve paths at startup while the cwd is known-good","Monitor os.Getwd() failures in long-running services"],"tags":["filesystem","path","startup"],"backgroundTag":"path-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}