{"record":{"id":"bf5886c88132604b","repo":"oraios/serena","slug":"ls-specific-settings-java-runtimes-must-be-a-list","errorCode":null,"errorMessage":"ls_specific_settings.java.runtimes must be a list of {name, path} entries, got {type(configured_runtimes).__name__}: {configured_runtimes!r}","messagePattern":"ls_specific_settings\\.java\\.runtimes must be a list of (.+?) entries, got (.+?): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/eclipse_jdtls.py","lineNumber":867,"sourceCode":"\n        # bundled runtime fallback...\n        log.info(f\"Using bundled JRE for Gradle: {self.runtime_dependency_paths.jre_path}\")\n        return self.runtime_dependency_paths.jre_path\n\n    def _resolve_configured_runtimes(self) -> list[dict[str, Any]]:\n        \"\"\"\n        Validate and normalize the optional extra JRE/JDK runtimes to register with JDT-LS, as configured\n        via ``ls_specific_settings.java.runtimes``. Each entry mirrors the shape VS Code's Java extension\n        sends via ``java.configuration.runtimes`` (``name``, ``path``, optional ``default``/``sources``/\n        ``javadoc``); see serena #1478.\n\n        :return: the validated list of runtime dicts (empty if the setting is unset)\n        :raises ValueError: if the setting or one of its entries is malformed\n        :raises FileNotFoundError: if an entry's ``path`` does not exist\n        \"\"\"\n        configured_runtimes = self._custom_settings.get(\"runtimes\", [])\n        if not isinstance(configured_runtimes, list):\n            raise ValueError(\n                f\"ls_specific_settings.java.runtimes must be a list of {{name, path}} entries, \"\n                f\"got {type(configured_runtimes).__name__}: {configured_runtimes!r}\"\n            )\n\n        # validate each entry and normalize it to the shape JDT-LS expects...\n        validated_runtimes: list[dict[str, Any]] = []\n        for entry in configured_runtimes:\n            if not isinstance(entry, dict) or \"name\" not in entry or \"path\" not in entry:\n                raise ValueError(\n                    f\"Invalid ls_specific_settings.java.runtimes entry {entry!r}: each entry requires at least a 'name' and a 'path' key.\"\n                )\n            path = entry[\"path\"]\n            if not os.path.exists(path):\n                error_msg = (\n                    f\"ls_specific_settings.java.runtimes entry '{entry['name']}' points to a path that \"\n                    f\"does not exist: {path}. Fix: update the path in ~/.serena/serena_config.yml \"\n                    f\"(ls_specific_settings -> java -> runtimes), or remove the entry.\"\n                )","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/eclipse_jdtls.py#L849-L885","documentation":"ValueError raised by _resolve_configured_runtimes when ls_specific_settings.java.runtimes is set but is not a list. The setting is expected to be a list of {name, path} JDK runtime entries that get validated and normalized into the javaRuntimes structure JDT-LS understands.","triggerScenarios":"_create_base_initialize_params -> _resolve_configured_runtimes where custom_settings['runtimes'] is a dict, string, or other non-list type; the isinstance(configured_runtimes, list) check fails and raises immediately.","commonSituations":"YAML mapping used instead of a YAML list (indentation mistake); runtimes written as a single object instead of a one-element list; JSON config with braces instead of brackets.","solutions":["Make runtimes a YAML/JSON list of entries, each with at least 'name' and 'path'","Wrap a single runtime object in a list: runtimes: [{name: ..., path: ...}]","Fix indentation so entries are list items (leading '-'), not mapping keys"],"exampleFix":"# before\nls_specific_settings:\n  java:\n    runtimes:\n      name: JavaSE-21\n      path: /usr/lib/jvm/temurin-21\n# after\nls_specific_settings:\n  java:\n    runtimes:\n      - name: JavaSE-21\n        path: /usr/lib/jvm/temurin-21","handlingStrategy":"type-guard","validationCode":"import yaml\ncfg = yaml.safe_load(open(\"~/.serena/serena_config.yml\"))\nruntimes = cfg.get(\"ls_specific_settings\", {}).get(\"java\", {}).get(\"runtimes\", [])\nassert isinstance(runtimes, list), \"runtimes must be a list of {name, path} entries\"","typeGuard":"def is_runtimes_list(v: object) -> bool:\n    return isinstance(v, list)","tryCatchPattern":"try:\n    params = provider._create_base_initialize_params()\nexcept ValueError as e:\n    if str(e).startswith(\"ls_specific_settings.java.runtimes must be a list\"):\n        cfg[\"ls_specific_settings\"][\"java\"][\"runtimes\"] = [cfg[\"ls_specific_settings\"][\"java\"][\"runtimes\"]]  # wrap single object in list\n        params = provider._create_base_initialize_params()\n    else:\n        raise","preventionTips":["Use list syntax (leading '-') in YAML for each runtime entry","Keep a schema or lint check on serena_config.yml","Validate the loaded config type before starting the language server","Remember a single runtime still needs to be a one-element list"],"tags":["configuration","schema-validation","jdtls","yaml"],"backgroundTag":"invalid-config-type","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}