{"record":{"id":"c1a2ee5ec3ec2eaa","repo":"gastownhall/beads","slug":"locate-bd-executable-w","errorCode":null,"errorMessage":"locate bd executable: %w","messagePattern":"locate bd executable: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dbproxy/proxy/endpoint.go","lineNumber":435,"sourceCode":"\ntype spawnedProxyChild struct {\n\tcmd    *exec.Cmd\n\tdone   <-chan error\n\thandle *procid.Handle\n\tmarker spawnMarker\n}\n\nfunc forkExecChild(rootDir string, opts OpenOpts, port int, stopEpoch string, lock *util.Lock) (*spawnedProxyChild, error) {\n\treleased := false\n\tdefer func() {\n\t\tif !released {\n\t\t\tlock.Unlock()\n\t\t}\n\t}()\n\n\tself, err := ResolveExecutable()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"locate bd executable: %w\", err)\n\t}\n\n\tidleTimeout := opts.IdleTimeout\n\tif idleTimeout < 0 {\n\t\tidleTimeout = IdleTimeoutNever\n\t}\n\n\targs := []string{\n\t\t\"db-proxy-child\",\n\t\t\"--root\", rootDir,\n\t\t\"--port\", strconv.Itoa(port),\n\t\t\"--idle-timeout\", idleTimeout.String(),\n\t\t\"--backend\", string(opts.Backend),\n\t\t\"--stop-epoch\", stopEpoch,\n\t}\n\tif opts.ConfigFilePath != \"\" {\n\t\targs = append(args, \"--config\", opts.ConfigFilePath)\n\t}","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/proxy/endpoint.go#L417-L453","documentation":"Returned by forkExecChild when ResolveExecutable cannot locate the bd executable needed to re-exec itself as the db-proxy child. The proxy spawn mechanism re-invokes the same binary (`bd db-proxy-child`), so if the running binary's path can't be resolved, the spawn fails before any process is created.","triggerScenarios":"forkExecChild (via spawnAndHandoff → GetCreateDatabaseProxyServerEndpoint) runs when the bd binary has been deleted/moved after start, os.Executable fails, the binary was invoked through a symlink since removed, or in odd environments (tmpfs-cleared paths, containers).","commonSituations":"Upgrading/replacing the bd binary while a command is running; running bd from a deleted temp download; invoking through a transient symlink; container images where the binary path differs between build and runtime.","solutions":["Reinstall or restore the bd binary at its expected location and retry.","Run bd from a stable installed path (not a temp file or ephemeral symlink).","Check the wrapped error from ResolveExecutable for the specific lookup failure (os.Executable error vs missing file).","In containers, bake bd into the image at a fixed path and invoke it via that path."],"exampleFix":"// before: running from a throwaway path\n/tmp/download/bd doctor  # later spawns fail: binary gone\n// after: install to a stable location first\ncp -f /tmp/download/bd /usr/local/bin/bd && /usr/local/bin/bd doctor","handlingStrategy":"validation","validationCode":"self, err := os.Executable()\nif err != nil { return err }\nif _, err := os.Stat(self); err != nil { return fmt.Errorf(\"bd binary missing at %s: %w\", self, err) }","typeGuard":null,"tryCatchPattern":"ep, err := GetCreateDatabaseProxyServerEndpoint(rootDir, opts)\nif err != nil && strings.Contains(err.Error(), \"locate bd executable\") {\n    return fmt.Errorf(\"bd binary moved/deleted; reinstall and retry: %w\", err)\n}","preventionTips":["Never delete/replace the running bd binary mid-session; install new versions atomically afterward","Run bd from a stable installed path, not temp dirs or transient symlinks","In containers, bake bd into the image at a fixed path","Don't invoke bd through symlinks that may be removed"],"tags":["go","executable-not-found","process-spawn"],"backgroundTag":"executable-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}