{"record":{"id":"9d2e954751b21832","repo":"hashicorp/nomad","slug":"failed-to-resolve-path-to-q-executable-v","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/java/driver.go","lineNumber":752,"sourceCode":"\tstream drivers.ExecTaskStream) error {\n\n\tif len(command) == 0 {\n\t\treturn fmt.Errorf(\"error cmd must have at least one value\")\n\t}\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn drivers.ErrTaskNotFound\n\t}\n\n\treturn handle.exec.ExecStreaming(ctx, command, tty, stream)\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","sourceCodeStart":734,"sourceCodeEnd":757,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/java/driver.go#L734-L757","documentation":"GetAbsolutePath resolves a binary via exec.LookPath (searching $PATH) and then canonicalizes symlinks with filepath.EvalSymlinks. If LookPath cannot find the executable in any PATH directory, the driver wraps the underlying error with this message. It is thrown when starting a task whose driver configuration references a binary that is not installed or not on PATH.","triggerScenarios":"StartTask calls GetAbsolutePath(bin) with a binary name like \"java\" that exec.LookPath cannot locate on the host (or in the chroot/image) the Nomad client runs in.","commonSituations":"JVM not installed on the Nomad client; task 'driver.config' or task command references a binary under a name that exists only in the user's shell (alias or shell function); PATH differs between interactive shell and the nomad agent systemd unit; binary exists but lacks execute permission.","solutions":["Install the missing binary on the Nomad client host (e.g. openjdk-17-jre) or fix the binary name in the task config.","Verify with `which <bin>` as the same user the nomad agent runs as; systemd units often have a minimal PATH.","Use an absolute path to the executable in the task config instead of relying on PATH lookup.","Check file permissions (chmod +x) and that the binary is for the correct OS/architecture."],"exampleFix":"// before (task config)\ncommand = \"java8\"\n// after\ncommand = \"/usr/lib/jvm/java-17-openjdk-amd64/bin/java\"","handlingStrategy":"validation","validationCode":"lp, err := exec.LookPath(\"java\")\nif err != nil {\n    return fmt.Errorf(\"java not on PATH for nomad agent user: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if _, err := driver.GetAbsolutePath(\"java\"); err != nil {\n    // treat as environment problem: fail placement, surface inner LookPath error\n    return fmt.Errorf(\"java driver unavailable: %w\", err)\n}","preventionTips":["Verify `which <bin>` as the same user the nomad agent runs as (systemd PATH differs from shells).","Prefer absolute paths in task configs over PATH-dependent binary names.","Use driver fingerprint/health checks to detect missing binaries before placement.","Install JVMs via the OS package manager so they land on standard PATHs."],"tags":["nomad","java-driver","path-resolution","executable-not-found"],"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-08T15:18:49.778Z"}