{"record":{"id":"57b2b63faaeac023","repo":"oraios/serena","slug":"mode-name-not-found-in-serenapaths-user-modes","errorCode":null,"errorMessage":"Mode {name} not found in {SerenaPaths().user_modes_dir} or in {SERENAS_OWN_MODE_YAMLS_DIR}.Available modes:\n{cls.list_registered_mode_names()}","messagePattern":"Mode (.+?) not found in (.+?) or in (.+?)\\.Available modes:\n(.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/config/context_mode.py","lineNumber":96,"sourceCode":"    def get_path(cls, name: str, instance: Self | None = None) -> str:\n        \"\"\"Get the path to the YAML file for a mode.\n\n        :param name: The name of the mode\n        :param instance: Optional mode instance. If provided and it has a stored path, that path is returned.\n        :return: The path to the mode's YAML file\n        \"\"\"\n        # If we have an instance with a stored path, use that\n        if instance is not None and instance._yaml_path is not None:\n            return str(instance._yaml_path)\n\n        fname = f\"{name}.yml\"\n        custom_mode_path = os.path.join(SerenaPaths().user_modes_dir, fname)\n        if os.path.exists(custom_mode_path):\n            return custom_mode_path\n\n        own_yaml_path = os.path.join(SERENAS_OWN_MODE_YAMLS_DIR, fname)\n        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)","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/config/context_mode.py#L78-L114","documentation":"SerenaMode.get_path resolves a mode name to a YAML file, first in the user modes directory, then in Serena's bundled mode YAMLs. If neither contains <name>.yml, FileNotFoundError is raised, listing all registered modes to help the user pick a valid one.","triggerScenarios":"Starting Serena (or from_name('...')) with --mode <name> / mode config referencing a mode that has no YAML in either ~/.serena/modes or serena's resources; typo in mode name; referencing a mode removed in a newer Serena version.","commonSituations":"CLI flag typos like --mode interprative instead of interactive; copying config from docs of a different Serena version; deleting or renaming custom mode YAMLs; wrong user config dir (HOME change) so user modes aren't found.","solutions":["Run cls.list_registered_mode_names() (or check the error's listed modes) and use an exact existing mode name","Create a custom mode YAML at SerenaPaths().user_modes_dir/<name>.yml","Fix the mode name typo in your CLI flags or serena_config","After upgrading Serena, check release notes for renamed/removed modes"],"exampleFix":"// before\nserena --mode editting\n// after\nserena --mode editing  # or a listed mode name","handlingStrategy":"validation","validationCode":"from serena.config.context_mode import SerenaMode\nnames = SerenaMode.list_registered_mode_names()\nassert mode_name in names, f\"Unknown mode {mode_name}; available: {names}\"","typeGuard":null,"tryCatchPattern":"try:\n    mode = SerenaMode.from_name(mode_name)\nexcept FileNotFoundError as e:\n    logger.warning(\"%s; falling back to default mode\", e)\n    mode = SerenaMode.from_name(\"default\")","preventionTips":["List registered modes before configuring","Keep custom mode YAMLs in ~/.serena/modes with matching filenames","After Serena upgrades, re-check mode names in flags/config","Avoid typos by copying names from the error's available list"],"tags":["configuration","file-not-found","modes"],"backgroundTag":"config-file-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}