{"record":{"id":"b3a4c55ae7987b4a","repo":"oraios/serena","slug":"java-home-explicit-home-is-invalid-candidat-b3a4c5","errorCode":null,"errorMessage":"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}.","messagePattern":"java_home='(.+?)' is invalid: '(.+?)' does not exist\\. Set ls_specific_settings\\.nextflow\\.java_home to a JDK home that contains bin/(.+?)\\.","errorType":"exception","errorClass":"SolidLSPException","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/nextflow_language_server.py","lineNumber":149,"sourceCode":"            if not isinstance(jvm_options, list):\n                log.warning(\"The 'jvm_options' setting should be a list of strings. Ignoring the provided value: %s\", jvm_options)\n                jvm_options = []\n            return [java_exe, *jvm_options, \"-jar\", core_path]\n\n        def _resolve_java(self) -> str:\n            \"\"\"\n            Locates a ``java`` executable (``java_home`` setting -> ``JAVA_HOME`` -> PATH) and verifies\n            that it is new enough to run the language server.\n\n            :return: the path to the java executable\n            \"\"\"\n            java_exe_name = \"java.exe\" if os.name == \"nt\" else \"java\"\n\n            java_exe: str | None = None\n            if explicit_home := self._custom_settings.get(\"java_home\"):\n                candidate = str(Path(explicit_home) / \"bin\" / java_exe_name)\n                if not os.path.exists(candidate):\n                    raise SolidLSPException(\n                        f\"java_home='{explicit_home}' is invalid: '{candidate}' does not exist. \"\n                        f\"Set ls_specific_settings.nextflow.java_home to a JDK home that contains bin/{java_exe_name}.\"\n                    )\n                java_exe = candidate\n            elif env_home := os.environ.get(\"JAVA_HOME\"):\n                candidate = str(Path(env_home) / \"bin\" / java_exe_name)\n                if os.path.exists(candidate):\n                    java_exe = candidate\n                else:\n                    log.warning(\"JAVA_HOME='%s' invalid (no '%s'), falling back to PATH.\", env_home, candidate)\n            if java_exe is None:\n                java_exe = shutil.which(\"java\")\n            if java_exe is None:\n                raise SolidLSPException(\n                    \"Could not locate a Java installation for the Nextflow language server. \"\n                    \"Set ls_specific_settings.nextflow.java_home, set the JAVA_HOME environment variable, \"\n                    f\"or ensure 'java' is on PATH. Required: JDK {MIN_JDK_VERSION}+.\"\n                )","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/nextflow_language_server.py#L131-L167","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Set ls_specific_settings.nextflow.java_home to the real JDK home (the directory containing bin/java), not its bin/ subdirectory.","Verify with: ls <java_home>/bin/java (or bin/java.exe on Windows) before restarting.","Remove the java_home override entirely and rely on JAVA_HOME or the java on PATH (must be JDK 17+)."],"exampleFix":"// before\nls_specific_settings.nextflow.java_home = \"/usr/lib/jvm/jdk-17/bin\"\n// after\nls_specific_settings.nextflow.java_home = \"/usr/lib/jvm/jdk-17\"","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\ndef validate_java_home(home):\n    exe = \"java.exe\" if os.name == \"nt\" else \"java\"\n    return os.path.exists(str(Path(home) / \"bin\" / exe))","typeGuard":"def is_jdk_home(path) -> bool:\n    try:\n        return Path(path).is_dir() and (Path(path) / 'bin' / ('java.exe' if os.name == 'nt' else 'java')).is_file()\n    except TypeError:\n        return False","tryCatchPattern":null,"preventionTips":["Point java_home at the JDK root, never its bin/ subdirectory.","Run `echo $JAVA_HOME` / `java -XshowSettings:properties -version` to find the real java.home.","Re-validate java_home after every JDK upgrade."],"tags":["java","configuration","nextflow","language-server"],"backgroundTag":"invalid-java-home","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}