{"record":{"id":"3846bf54990f9139","repo":"oraios/serena","slug":"invalid-language-server-orig-language-str-nv","errorCode":null,"errorMessage":"Invalid language server: '{orig_language_str}'.\\nValid values are: {[l.value for l in LanguageServerId]}","messagePattern":"Invalid language server: '(.+?)'\\.\\\\nValid values are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/serena/config/serena_config.py","lineNumber":593,"sourceCode":"        Create a ProjectConfig instance from a (full) configuration dictionary\n\n        :param data: the configuration dictionary; must contain all required fields and use the same field names as\n            the ProjectConfig dataclass\n        :param local_override_keys: the list of keys that have been overridden from project.local.yml\n        \"\"\"\n        # map languages to list of enum items, checking for errors\n        lang_name_mapping = {\"javascript\": \"typescript\"}\n        ls_ids: list[LanguageServerId] = []\n        for ls_str in data[\"language_servers\"]:\n            orig_language_str = ls_str\n            try:\n                ls_str = ls_str.lower()\n                if ls_str in lang_name_mapping:\n                    ls_str = lang_name_mapping[ls_str]\n                ls_id = LanguageServerId(ls_str)\n                ls_ids.append(ls_id)\n            except ValueError as e:\n                raise ValueError(\n                    f\"Invalid language server: '{orig_language_str}'.\\nValid values are: {[l.value for l in LanguageServerId]}\"\n                ) from e\n\n        # Validate activation_command_timeout\n        activation_command_timeout_raw = data.get(\"activation_command_timeout\", 180.0)\n        try:\n            activation_command_timeout = float(activation_command_timeout_raw)\n        except (TypeError, ValueError) as e:\n            raise ValueError(f\"activation_command_timeout must be a number, got: {activation_command_timeout_raw}\") from e\n        if activation_command_timeout <= 0:\n            raise ValueError(f\"activation_command_timeout must be positive, got: {activation_command_timeout}\")\n\n        # Validate symbol_info_budget\n        symbol_info_budget_raw = data[\"symbol_info_budget\"]\n        symbol_info_budget = symbol_info_budget_raw\n        if symbol_info_budget is not None:\n            try:\n                symbol_info_budget = float(symbol_info_budget_raw)","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/config/serena_config.py#L575-L611","documentation":"When parsing a Serena project config dict, _from_dict maps each entry of the 'language' list through LanguageServerId(ls_str). If the string is not a valid enum value (and is not resolved by the lang_name_mapping alias table), LanguageServerId(...) raises ValueError, which is re-raised with a message listing all valid values. This validates the 'language' field of .serena/project.yml before a language server is ever started.","triggerScenarios":"Calling ProjectConfig.autogenerate(..., languages=[...]) or ProjectConfig.load() on a project.yml whose 'language' entries contain a misspelled or unsupported language string (e.g. 'typescriptreact', 'py', 'js' if not aliased, or wrong case handled only for known aliases). Directly invoked by tests test_language_backend_parsed_from_dict etc.","commonSituations":"Hand-editing project.yml and writing 'python3' or 'typescript-react' instead of the enum value; copying config from another tool that uses different language names; a Serena version change where a language value was renamed or added; typos like 'pyton'.","solutions":["Read the valid values listed in the error message and replace the language string with an exact match, e.g. languages=['python','typescript']","Check LanguageServerId enum values (src/serena/config/serena_config.py) for the canonical spelling of your language","Run serena with --log-level debug or inspect lang_name_mapping to see supported aliases, or use an alias like 'py' if mapped","Upgrade/downgrade Serena if the language value existed in another version"],"exampleFix":"// before\nconfig = ProjectConfig.autogenerate(project_root=root, languages=[\"ts\", \"py\"])\n// after\nconfig = ProjectConfig.autogenerate(project_root=root, languages=[\"typescript\", \"python\"])","handlingStrategy":"validation","validationCode":"from serena.config.serena_config import LanguageServerId\nvalid = {l.value for l in LanguageServerId}\nbad = [lang for lang in languages if lang.lower() not in valid]\nif bad:\n    raise ValueError(f\"Invalid languages {bad}; valid values: {sorted(valid)}\")","typeGuard":"def is_valid_language(lang: str) -> bool:\n    from serena.config.serena_config import LanguageServerId\n    return lang.lower() in {l.value for l in LanguageServerId}","tryCatchPattern":"try:\n    config = ProjectConfig.autogenerate(project_root=root, languages=languages)\nexcept ValueError as e:\n    if 'Invalid language server' in str(e):\n        logger.error(\"Fix the 'language' entries in project.yml. %s\", e)\n    raise","preventionTips":["Copy language names exactly from the LanguageServerId enum values listed in the error message","Use lowercase canonical names like 'python', 'typescript', 'go' in project.yml","After upgrading Serena, diff your project.yml languages against the new enum","Prefer letting autogenerate detect languages instead of hand-writing them"],"tags":["python","configuration","validation","language-server","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}