oraios/serena · error · SolidLSPException

java_home='{explicit_home}' is invalid: '{candidate}' does n

Error message

java_home='{explicit_home}' is invalid: '{candidate}' does not exist. Set ls_specific_settings.nextflow.java_home to a JDK home that contains bin/{java_exe_name}.

What it means

The Nextflow language server resolves its Java executable via _resolve_java. When the user explicitly sets ls_specific_settings.nextflow.java_home, the library validates that bin/java (or bin/java.exe on Windows) exists under that directory. If it does not, SolidLSPException is thrown because an explicit override takes precedence and a wrong value must not be silently ignored.

Source

Thrown at src/solidlsp/language_servers/nextflow_language_server.py:149

            if not isinstance(jvm_options, list):
                log.warning("The 'jvm_options' setting should be a list of strings. Ignoring the provided value: %s", jvm_options)
                jvm_options = []
            return [java_exe, *jvm_options, "-jar", core_path]

        def _resolve_java(self) -> str:
            """
            Locates a ``java`` executable (``java_home`` setting -> ``JAVA_HOME`` -> PATH) and verifies
            that it is new enough to run the language server.

            :return: the path to the java executable
            """
            java_exe_name = "java.exe" if os.name == "nt" else "java"

            java_exe: str | None = None
            if explicit_home := self._custom_settings.get("java_home"):
                candidate = str(Path(explicit_home) / "bin" / java_exe_name)
                if not os.path.exists(candidate):
                    raise SolidLSPException(
                        f"java_home='{explicit_home}' is invalid: '{candidate}' does not exist. "
                        f"Set ls_specific_settings.nextflow.java_home to a JDK home that contains bin/{java_exe_name}."
                    )
                java_exe = candidate
            elif env_home := os.environ.get("JAVA_HOME"):
                candidate = str(Path(env_home) / "bin" / java_exe_name)
                if os.path.exists(candidate):
                    java_exe = candidate
                else:
                    log.warning("JAVA_HOME='%s' invalid (no '%s'), falling back to PATH.", env_home, candidate)
            if java_exe is None:
                java_exe = shutil.which("java")
            if java_exe is None:
                raise SolidLSPException(
                    "Could not locate a Java installation for the Nextflow language server. "
                    "Set ls_specific_settings.nextflow.java_home, set the JAVA_HOME environment variable, "
                    f"or ensure 'java' is on PATH. Required: JDK {MIN_JDK_VERSION}+."
                )

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Set ls_specific_settings.nextflow.java_home to the real JDK home (the directory containing bin/java), not its bin/ subdirectory.
  2. Verify with: ls <java_home>/bin/java (or bin/java.exe on Windows) before restarting.
  3. Remove the java_home override entirely and rely on JAVA_HOME or the java on PATH (must be JDK 17+).

Example fix

// before
ls_specific_settings.nextflow.java_home = "/usr/lib/jvm/jdk-17/bin"
// after
ls_specific_settings.nextflow.java_home = "/usr/lib/jvm/jdk-17"
Defensive patterns

Strategy: validation

Validate before calling

import os
from pathlib import Path

def validate_java_home(home):
    exe = "java.exe" if os.name == "nt" else "java"
    return os.path.exists(str(Path(home) / "bin" / exe))

Type guard

def is_jdk_home(path) -> bool:
    try:
        return Path(path).is_dir() and (Path(path) / 'bin' / ('java.exe' if os.name == 'nt' else 'java')).is_file()
    except TypeError:
        return False

Prevention

When it happens

Trigger: Setting ls_specific_settings.nextflow.java_home to a directory that is not a JDK home, e.g. a JRE root with a different layout, a truncated path, a path pointing to bin/ itself, or a typo, while calling the Nextflow language server startup (_create_launch_command -> _resolve_java).

Common situations: Pointing java_home at the JDK's bin/ directory instead of the home; pointing at a JRE that lacks bin/java; Windows users setting a POSIX-style path or vice versa; a JDK upgraded/removed so the old home no longer contains bin/java.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/b3a4c55ae7987b4a. Report an issue: GitHub.