{"record":{"id":"3c8d262ea341b7de","repo":"owasp-amass/amass","slug":"failed-to-get-executable-path-w","errorCode":null,"errorMessage":"failed to get executable path: %w","messagePattern":"failed to get executable path: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/amass/process.go","lineNumber":33,"sourceCode":")\n\nfunc engineIsRunning() bool {\n\tc, err := client.NewClient(\"http://127.0.0.1:4000\")\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)\n\tdefer cancel()\n\n\treturn c.HealthCheck(ctx)\n}\n\nfunc startEngine() error {\n\tp, err := os.Executable()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get executable path: %w\", err)\n\t}\n\tif p == \"\" {\n\t\treturn fmt.Errorf(\"executable path is empty\")\n\t}\n\n\tcmd := initCmd(p)\n\tif cmd == nil {\n\t\treturn fmt.Errorf(\"failed to initialize command for %s\", p)\n\t}\n\tcmd.Stdout = io.Discard\n\tcmd.Stderr = io.Discard\n\tcmd.Stdin = os.Stdin\n\n\tcmd.Dir, err = os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/cmd/amass/process.go#L15-L51","documentation":"startEngine calls os.Executable() to locate the current binary so it can relaunch it as the engine process. If the OS cannot determine the executable path, the error is wrapped with this message and returned.","triggerScenarios":"os.Executable() failing due to a deleted binary (/proc/self/exe gone), unusual runtime environments, or platform failures resolving the process image path.","commonSituations":"Running the binary from a tmpfs/overlay that was cleaned up while the process runs; executing via deleted in-place upgrades; exotic sandboxes where /proc is not mounted.","solutions":["Ensure the amass binary still exists on disk at the path it was launched from (don't delete/replace it while running).","Run in an environment where /proc is available and the executable path is resolvable.","Inspect the wrapped %w error for the OS-level cause and address that (permissions, mount, filesystem)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if _, err := os.Executable(); err != nil {\n    // resolve fallback path or abort before calling startEngine\n}","typeGuard":null,"tryCatchPattern":"if err := startEngine(); err != nil {\n    if strings.HasPrefix(err.Error(), \"failed to get executable path\") {\n        log.Fatalf(\"cannot locate running binary: %v — reinstall or launch from a stable path\", err)\n    }\n}","preventionTips":["Don't delete or replace the binary while it is running (avoid in-place upgrades).","Run in environments where /proc is mounted.","Install the binary at a stable absolute path and launch from there."],"tags":["filesystem","process","go"],"backgroundTag":"executable-path-resolution-failed","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}