{"record":{"id":"b363929006519912","repo":"oraios/serena","slug":"internal-mode-name-not-found-in-internal-mode","errorCode":null,"errorMessage":"Internal mode '{name}' not found in {INTERNAL_MODE_YAMLS_DIR}","messagePattern":"Internal mode '(.+?)' not found in (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/config/context_mode.py","lineNumber":113,"sourceCode":"        if not os.path.exists(own_yaml_path):\n            raise FileNotFoundError(\n                f\"Mode {name} not found in {SerenaPaths().user_modes_dir} or in {SERENAS_OWN_MODE_YAMLS_DIR}.\"\n                f\"Available modes:\\n{cls.list_registered_mode_names()}\"\n            )\n        return own_yaml_path\n\n    @classmethod\n    def from_name(cls, name: str) -> Self:\n        \"\"\"Load a registered Serena mode.\"\"\"\n        mode_path = cls.get_path(name)\n        return cls.from_yaml(mode_path)\n\n    @classmethod\n    def from_name_internal(cls, name: str) -> Self:\n        \"\"\"Loads an internal Serena mode\"\"\"\n        yaml_path = os.path.join(INTERNAL_MODE_YAMLS_DIR, f\"{name}.yml\")\n        if not os.path.exists(yaml_path):\n            raise FileNotFoundError(f\"Internal mode '{name}' not found in {INTERNAL_MODE_YAMLS_DIR}\")\n        return cls.from_yaml(yaml_path)\n\n    @classmethod\n    def list_registered_mode_names(cls, include_user_modes: bool = True) -> list[str]:\n        \"\"\"Names of all registered modes (from the corresponding YAML files in the serena repo).\"\"\"\n        modes = [f.stem for f in Path(SERENAS_OWN_MODE_YAMLS_DIR).glob(\"*.yml\") if f.name != \"mode.template.yml\"]\n        if include_user_modes:\n            modes += cls.list_custom_mode_names()\n        return sorted(set(modes))\n\n    @classmethod\n    def list_custom_mode_names(cls) -> list[str]:\n        \"\"\"Names of all custom modes defined by the user.\"\"\"\n        return [f.stem for f in Path(SerenaPaths().user_modes_dir).glob(\"*.yml\")]\n\n    @classmethod\n    def load(cls, name_or_path: str | Path) -> Self:\n        # If it is a path or looks like a path, load from file","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/config/context_mode.py#L95-L131","documentation":"from_name_internal loads one of Serena's internal modes directly from INTERNAL_MODE_YAMLS_DIR. If the internal mode's YAML file is missing there, FileNotFoundError is raised. This differs from get_path: internal modes are not user-overridable and must ship with the package.","triggerScenarios":"_update_active_modes activating a mode via from_name_internal with a name that has no corresponding YAML in the installed package's internal modes directory — typically an internal name typo or a broken/partial installation.","commonSituations":"Corrupted or partial pip install where resource YAMLs weren't packaged; running from a source checkout with missing resources; version mismatch where config references an internal mode that no longer exists; editing internal mode names in config by hand.","solutions":["Reinstall/repair Serena (pip install --force-reinstall serena) so bundled YAML resources are restored","Remove or correct the internal mode name in your config/active modes","Check you're not shadowing the package resources (run from a clean checkout, verify INTERNAL_MODE_YAMLS_DIR exists)","Downgrade/upgrade to a Serena version that includes that internal mode"],"exampleFix":"// before (config)\nactive_modes: [chat_internal_missing]\n// after\nactive_modes: [chat_internal]  # mode that exists in INTERNAL_MODE_YAMLS_DIR","handlingStrategy":"validation","validationCode":"from serena.config.context_mode import INTERNAL_MODE_YAMLS_DIR\nfrom pathlib import Path\nassert (Path(INTERNAL_MODE_YAMLS_DIR) / f\"{name}.yml\").is_file(), f\"Internal mode {name} missing\"","typeGuard":null,"tryCatchPattern":"try:\n    mode = SerenaMode.from_name_internal(name)\nexcept FileNotFoundError as e:\n    logger.error(\"Installation may be broken: %s\", e)\n    raise SystemExit(\"Reinstall serena: pip install --force-reinstall serena\")","preventionTips":["Reinstall the package if bundled resources are missing","Never hand-edit internal mode names in configs","Verify INTERNAL_MODE_YAMLS_DIR exists when running from source"],"tags":["configuration","internal-mode","file-not-found"],"backgroundTag":"missing-package-resource","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}