{"record":{"id":"d8ff28a1d453ffd2","repo":"hashicorp/nomad","slug":"failed-to-resolve-path-to-q-executable-v-d8ff28","errorCode":null,"errorMessage":"failed to resolve path to %q executable: %v","messagePattern":"failed to resolve path to %q executable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/qemu/driver.go","lineNumber":823,"sourceCode":"func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error) {\n\treturn d.eventer.TaskEvents(ctx)\n}\n\nfunc (d *Driver) SignalTask(_ string, _ string) error {\n\treturn fmt.Errorf(\"QEMU driver can't signal commands\")\n}\n\nfunc (d *Driver) ExecTask(_ string, _ []string, _ time.Duration) (*drivers.ExecTaskResult, error) {\n\treturn nil, fmt.Errorf(\"QEMU driver can't execute commands\")\n\n}\n\n// GetAbsolutePath returns the absolute path of the passed binary by resolving\n// it in the path and following symlinks.\nfunc GetAbsolutePath(bin string) (string, error) {\n\tlp, err := exec.LookPath(bin)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to resolve path to %q executable: %v\", bin, err)\n\t}\n\n\treturn filepath.EvalSymlinks(lp)\n}\n\nfunc (d *Driver) handleWait(ctx context.Context, handle *taskHandle, ch chan *drivers.ExitResult) {\n\tdefer close(ch)\n\tvar result *drivers.ExitResult\n\tps, err := handle.exec.Wait(ctx)\n\tif err != nil {\n\t\tresult = &drivers.ExitResult{\n\t\t\tErr: fmt.Errorf(\"executor: error waiting on process: %v\", err),\n\t\t}\n\t\t// if process state is nil, we've probably been killed, so return a reasonable\n\t\t// exit state to the handlers\n\t\tif ps == nil {\n\t\t\tresult.ExitCode = -1\n\t\t\tresult.OOMKilled = false","sourceCodeStart":805,"sourceCodeEnd":841,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/qemu/driver.go#L805-L841","documentation":"GetAbsolutePath resolves a binary via exec.LookPath and returns this error when the binary cannot be found in PATH. In the QEMU driver it is called during StartTask to locate the qemu-system binary, failing task startup.","triggerScenarios":"StartTask with driver config pointing to a qemu binary name (e.g. \"qemu-system-x86_64\") that exec.LookPath cannot resolve on the Nomad client host.","commonSituations":"QEMU not installed on the host; PATH differs between the Nomad agent environment and user shell (systemd service with minimal PATH); binary installed under a non-PATH directory; typo in driver config image/binary path.","solutions":["Install qemu-system-x86 (or the arch-specific package) on the Nomad client","Set the full absolute path to the QEMU binary in the driver/task configuration instead of relying on PATH","Fix PATH for the Nomad agent service (e.g. systemd Environment= or ExecStart wrapper)","Verify with `which qemu-system-x86_64` as the same user the agent runs as"],"exampleFix":"// before\nimage_path = \"qemu-system-x86_64\" // resolved via PATH, fails if not found\n// after\nimage_path = \"/usr/bin/qemu-system-x86_64\" // absolute path bypasses PATH lookup","handlingStrategy":"validation","validationCode":"path, err := exec.LookPath(qemuBin)\nif err != nil {\n    return fmt.Errorf(\"qemu binary %q not found in PATH: %w\", qemuBin, err)\n}","typeGuard":null,"tryCatchPattern":"if _, err := qemu.GetAbsolutePath(qemuBin); err != nil {\n    // fail fast with a clear message before StartTask\n    return err\n}","preventionTips":["Configure the absolute path to the QEMU binary in task config","Verify binary presence with `which` as the user running the Nomad agent","Ensure the Nomad service unit has PATH including /usr/bin and /usr/local/bin"],"tags":["qemu","path-resolution","exec-lookpath","nomad-driver"],"backgroundTag":"binary-not-found-on-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"}