{"record":{"id":"27980b703a6acc84","repo":"hashicorp/nomad","slug":"unable-to-find-the-nomad-binary-v","errorCode":null,"errorMessage":"unable to find the nomad binary: %v","messagePattern":"unable to find the nomad binary: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/shared/executor/utils.go","lineNumber":45,"sourceCode":"\t// searching for an available port\n\tExecutorDefaultMinPort = 14000\n)\n\n// CreateExecutor launches an executor plugin and returns an instance of the\n// Executor interface\nfunc CreateExecutor(\n\tlogger hclog.Logger,\n\tdriverConfig *base.ClientDriverConfig,\n\texecutorConfig *ExecutorConfig,\n) (Executor, *plugin.Client, error) {\n\n\tc, err := json.Marshal(executorConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to create executor config: %v\", err)\n\t}\n\tbin, err := os.Executable()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to find the nomad binary: %v\", err)\n\t}\n\n\tp := &ExecutorPlugin{\n\t\tlogger:      logger,\n\t\tfsIsolation: executorConfig.FSIsolation,\n\t\tcompute:     driverConfig.Topology.Compute(),\n\t}\n\n\tconfig := &plugin.ClientConfig{\n\t\tHandshakeConfig:  base.Handshake,\n\t\tPlugins:          map[string]plugin.Plugin{\"executor\": p},\n\t\tCmd:              exec.Command(bin, \"executor\", string(c)),\n\t\tAllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},\n\t\tLogger:           logger.Named(\"executor\"),\n\t}\n\n\tif driverConfig != nil {\n\t\tconfig.MaxPort = driverConfig.ClientMaxPort","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/shared/executor/utils.go#L27-L63","documentation":"CreateExecutor must locate the current Nomad binary via os.Executable() so it can relaunch it as the executor plugin subprocess. This error means os.Executable() failed, so the executor plugin cannot be started from the running binary path.","triggerScenarios":"os.Executable() returning an error — running in an environment where the executable path cannot be determined (deleted/renamed binary while running, unusual sandbox or init setups, platforms where /proc lookup fails).","commonSituations":"Nomad binary deleted or replaced on disk while the agent runs; running Nomad under unusual process launchers; minimal containers lacking /proc/self/exe resolution; in-memory or embedded execution contexts.","solutions":["Ensure the Nomad binary exists at its original path while the agent is running (don't delete/replace before restart)","Restart the Nomad agent after upgrading/replacing the binary","Run Nomad from a standard filesystem path inside a normal container/host environment (verify /proc is mounted on Linux)","Check the wrapped OS error (%v) for the underlying reason and address it specifically"],"exampleFix":"// before\n# rm /usr/local/bin/nomad && start nomad-from-memory\n// after\n# install new binary, restart service:\n# systemctl restart nomad","handlingStrategy":"validation","validationCode":"if _, err := os.Executable(); err != nil { /* resolve/fail early before CreateExecutor */ }","typeGuard":null,"tryCatchPattern":"exec, _, err := executor.CreateExecutor(logger, drvCfg, cfg)\nif err != nil && strings.Contains(err.Error(), \"unable to find the nomad binary\") {\n    return fmt.Errorf(\"cannot relaunch executor: %w\", err)\n}","preventionTips":["Never delete or rename the running Nomad binary before restart","Restart the agent after binary replacement/upgrade","Run Nomad in environments where os.Executable() resolves (/proc mounted, standard launcher)"],"tags":["filesystem","executable","executor-plugin"],"backgroundTag":"executable-not-found-in-path","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}