hashicorp/nomad · error
failed to check java version: %v
Error message
failed to check java version: %v
What it means
javaVersionInfo runs the java -version command (and on macOS first checks for a JVM) to learn version/runtime/VM for fingerprinting and compatibility checks. When the macOS JVM probe itself fails, the underlying checkForMacJVM error is re-wrapped with this generic message. The wrapped 'failed check for macOS jvm' error carries the root cause and probe output.
Source
Thrown at drivers/java/utils.go:38
var out bytes.Buffer
cmd := exec.Command(macOSJavaTestCommand)
cmd.Stdout = &out
cmd.Stderr = &out
err = cmd.Run()
if err != nil {
err = fmt.Errorf("failed check for macOS jvm: %v, out: %v", err, strings.ReplaceAll(strings.ReplaceAll(out.String(), "\n", " "), `"`, `\"`))
return false, err
}
return true, nil
}
func javaVersionInfo() (version, runtime, vm string, err error) {
var out bytes.Buffer
if rt.GOOS == "darwin" {
_, err = checkForMacJVM()
if err != nil {
err = fmt.Errorf("failed to check java version: %v", err)
return
}
}
cmd := exec.Command(javaVersionCommand[0], javaVersionCommand[1:]...)
cmd.Stdout = &out
cmd.Stderr = &out
err = cmd.Run()
if err != nil {
err = fmt.Errorf("failed to check java version: %v", err)
return
}
version, runtime, vm = parseJavaVersionOutput(out.String())
return
}
var (View on GitHub (pinned to 482b49bf1a)
Solutions
- Install a JDK on the macOS client so the java_home probe succeeds.
- Inspect the inner 'failed check for macOS jvm: ..., out: ...' message for the probe's actual output.
- Run /usr/libexec/java_home manually to confirm it exits 0.
Defensive patterns
Strategy: try-catch
Validate before calling
if runtime.GOOS == "darwin" {
out, err := exec.Command("/usr/libexec/java_home").Output()
if err != nil {
return fmt.Errorf("install a JDK on this Mac first: %v (%s)", err, out)
}
} Try / catch
version, runtime_, vm, err := javaVersionInfo()
if err != nil {
if strings.Contains(err.Error(), "macOS jvm") {
// root cause: JVM probe failed; see inner checkForMacJVM message
}
return err
} Prevention
- Keep a valid JDK installed on all macOS clients used for java tasks.
- Watch fingerprint health so driver unhealthiness is caught before job submission.
- Unwrap the error chain to read the probe output embedded by checkForMacJVM.
When it happens
Trigger: Calling buildFingerprint or javaCompatible on a darwin client when checkForMacJVM's probe command exits non-zero — typically no JDK installed on the Mac.
Common situations: Mac dev/CI machines without Java; fingerprinting a newly joined Nomad macOS client; JAVA_HOME broken after OS/java upgrade so the probe fails.
Related errors
- failed check for macOS jvm: %v, out: %v
- missing attributes for client registration
- failed to probe plugin: %w
- failed to detect CNI conf files: %v
- default_pid_mode must be %q or %q, got %q
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/fd459628401cc8a6.
Report an issue: GitHub.