{"record":{"id":"ed254338f469e107","repo":"gastownhall/beads","slug":"sidecar-dolt-binary-q-resolving-absolute-path","errorCode":null,"errorMessage":"sidecar dolt binary %q: resolving absolute path: %w","messagePattern":"sidecar dolt binary %q: resolving absolute path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/doltversion/resolve.go","lineNumber":131,"sourceCode":"// binary and launching a different one. filepath.Abs forces both steps to\n// agree on the same cwd-relative file in that case.\nfunc Resolve(opts ResolveOptions) (string, Source, error) {\n\tif opts.EnvValue != \"\" {\n\t\tabs, err := filepath.Abs(opts.EnvValue)\n\t\tif err != nil {\n\t\t\treturn \"\", SourceEnv, fmt.Errorf(\"%s=%q: resolving absolute path: %w\", DoltBinEnvVar, opts.EnvValue, err)\n\t\t}\n\t\tabs = completeExecutableExt(abs)\n\t\tif err := validateExplicitPath(abs); err != nil {\n\t\t\treturn \"\", SourceEnv, fmt.Errorf(\"%s=%q: %w\", DoltBinEnvVar, opts.EnvValue, err)\n\t\t}\n\t\treturn abs, SourceEnv, nil\n\t}\n\n\tif opts.SidecarValue != \"\" {\n\t\tabs, err := filepath.Abs(opts.SidecarValue)\n\t\tif err != nil {\n\t\t\treturn \"\", SourceSidecar, fmt.Errorf(\"sidecar dolt binary %q: resolving absolute path: %w\", opts.SidecarValue, err)\n\t\t}\n\t\tabs = completeExecutableExt(abs)\n\t\tif err := validateExplicitPath(abs); err != nil {\n\t\t\treturn \"\", SourceSidecar, fmt.Errorf(\"sidecar dolt binary %q: %w\", opts.SidecarValue, err)\n\t\t}\n\t\treturn abs, SourceSidecar, nil\n\t}\n\n\tpath, err := exec.LookPath(\"dolt\")\n\tif err != nil {\n\t\treturn \"\", SourcePath, fmt.Errorf(\"%w: dolt not found on PATH: %v\", ErrNotFound, err)\n\t}\n\treturn path, SourcePath, nil\n}\n\n// completeExecutableExt completes a Windows executable extension on an\n// explicitly-named path spelled without one: BEADS_DOLT_BIN=C:\\tools\\dolt\n// should find C:\\tools\\dolt.exe the same way cmd.exe or exec.LookPath","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/doltversion/resolve.go#L113-L149","documentation":"Resolve wraps the error from filepath.Abs when it cannot convert the explicitly configured sidecar dolt binary path to an absolute path. filepath.Abs only fails when os.Getwd fails (e.g. the current working directory was deleted), so this is rare and indicates a broken process environment rather than a bad sidecar value. The sidecar source is reported so diagnostics show which precedence level failed.","triggerScenarios":"Calling Resolve with ResolveOptions.SidecarValue non-empty while the process's working directory has been removed (os.Getwd fails inside filepath.Abs).","commonSituations":"Running the process after its cwd was deleted (e.g. a temp dir or removed checkout); launching from a container/CI workspace that was cleaned up mid-run.","solutions":["Restart the process from an existing working directory","Check the cwd exists: run pwd / os.Getwd() and recreate it if deleted","If the sidecar value is wrong, fix the clone-local sidecar setting to point at a real dolt binary","Fallback: unset/empty the sidecar value so Resolve proceeds to PATH lookup"],"exampleFix":"// before\nbd served   # launched from a deleted checkout directory\n// after\ncd /path/to/existing/repo && bd served","handlingStrategy":"validation","validationCode":"if _, err := os.Getwd(); err != nil {\n    return fmt.Errorf(\"working directory unavailable, cannot resolve sidecar binary: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"path, src, err := doltversion.Resolve(opts)\nif err != nil {\n    var nf *fs.PathError\n    if errors.As(err, &nf) { /* report cwd problem */ }\n    return fmt.Errorf(\"resolving dolt binary: %w\", err)\n}","preventionTips":["Launch processes from an existing directory","Avoid deleting a checkout/workspace while its processes are running","In CI, keep the workspace alive for the process lifetime"],"tags":["go","dolt","binary-resolution","filepath","sidecar"],"backgroundTag":"working-directory-missing","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}