oraios/serena · error · SolidLSPException

Could not locate a Java installation for the Nextflow langua

Error message

Could not locate a Java installation for the Nextflow language server. Set ls_specific_settings.nextflow.java_home, set the JAVA_HOME environment variable, or ensure 'java' is on PATH. Required: JDK 17+.

What it means

_resolve_java tries three sources for a Java executable in order: the explicit java_home setting, the JAVA_HOME environment variable, and 'java' on PATH. If none yields a usable executable, SolidLSPException is thrown telling the user every option for providing a JDK 17+.

Source

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

            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}+."
                )

            # reuse JDTLS's JVM interrogation, which reports the real java.home even for stub launchers
            from solidlsp.language_servers.eclipse_jdtls import EclipseJDTLS

            java_home, major_version = EclipseJDTLS.DependencyProvider._inspect_java(java_exe)
            if major_version < MIN_JDK_VERSION:
                raise SolidLSPException(
                    f"The Nextflow language server requires JDK {MIN_JDK_VERSION}+ but '{java_exe}' is JDK {major_version} "
                    f"(java.home={java_home}). Install a newer JDK and update ls_specific_settings.nextflow.java_home "
                    "or JAVA_HOME."
                )
            log.info("Using JDK %d at %s for the Nextflow language server", major_version, java_exe)
            return java_exe

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install JDK 17+ (e.g. apt install openjdk-17-jdk, brew install openjdk@17) and ensure java is on PATH.
  2. Set the JAVA_HOME environment variable to the JDK home directory.
  3. Set ls_specific_settings.nextflow.java_home to a valid JDK home containing bin/java.

Example fix

// before
# no java configured, server fails to start
// after
export JAVA_HOME=/usr/lib/jvm/jdk-17
export PATH="$JAVA_HOME/bin:$PATH"
Defensive patterns

Strategy: validation

Validate before calling

import shutil

def java_available():
    return bool(shutil.which("java")) or bool(os.environ.get("JAVA_HOME"))

Try / catch

from solidlsp import SolidLSPException
try:
    server = NextflowLanguageServer(...)
except SolidLSPException as e:
    logger.error("No JDK found: %s", e)
    raise SystemExit("Install JDK 17+ and set JAVA_HOME")

Prevention

When it happens

Trigger: Starting the Nextflow language server when ls_specific_settings.nextflow.java_home is unset, JAVA_HOME is unset (or its bin/java is missing, causing a logged fallback), and shutil.which("java") finds nothing.

Common situations: Docker/CI containers with no JDK installed; headless servers without Java; python venvs where PATH is minimal; JAVA_HOME set to a corrupted install whose bin/java was deleted.

Related errors


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