{"record":{"id":"2a1cd2609eea0228","repo":"oraios/serena","slug":"internal-mode-from-internal-not-found-in-sere","errorCode":null,"errorMessage":"Internal mode '{from_internal}' not found in {SERENAS_OWN_MODE_YAMLS_DIR}. Available modes: {SerenaAgentMode.list_registered_mode_names()}","messagePattern":"Internal mode '(.+?)' not found in (.+?)\\. Available modes: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/cli.py","lineNumber":550,"sourceCode":"        \"--name\",\n        \"-n\",\n        type=str,\n        default=None,\n        help=\"Name for the new mode. If --from-internal is passed may be left empty to create a mode of the same name, which will then override the internal mode.\",\n    )\n    @click.option(\"--from-internal\", \"from_internal\", type=str, default=None, help=\"Copy from an internal mode.\")\n    def create(name: str, from_internal: str) -> None:\n        if not (name or from_internal):\n            raise click.UsageError(\"Provide at least one of --name or --from-internal.\")\n        mode_name = name or from_internal\n        dest = os.path.join(SerenaPaths().user_modes_dir, f\"{mode_name}.yml\")\n        src = (\n            os.path.join(SERENAS_OWN_MODE_YAMLS_DIR, f\"{from_internal}.yml\")\n            if from_internal\n            else os.path.join(SERENAS_OWN_MODE_YAMLS_DIR, \"mode.template.yml\")\n        )\n        if not os.path.exists(src):\n            raise FileNotFoundError(\n                f\"Internal mode '{from_internal}' not found in {SERENAS_OWN_MODE_YAMLS_DIR}. Available modes: {SerenaAgentMode.list_registered_mode_names()}\"\n            )\n        os.makedirs(os.path.dirname(dest), exist_ok=True)\n        shutil.copyfile(src, dest)\n        click.echo(f\"Created mode '{mode_name}' at {dest}\")\n        _open_in_editor(dest)\n\n    @staticmethod\n    @click.command(\"edit\", help=\"Edit a custom mode YAML file.\", context_settings={\"max_content_width\": _MAX_CONTENT_WIDTH})\n    @click.argument(\"mode_name\")\n    def edit(mode_name: str) -> None:\n        path = os.path.join(SerenaPaths().user_modes_dir, f\"{mode_name}.yml\")\n        if not os.path.exists(path):\n            if mode_name in SerenaAgentMode.list_registered_mode_names(include_user_modes=False):\n                click.echo(\n                    f\"Mode '{mode_name}' is an internal mode and cannot be edited directly. \"\n                    f\"Use 'mode create --from-internal {mode_name}' to create a custom mode that overrides it before editing.\"\n                )","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/cli.py#L532-L568","documentation":"`serena mode create --from <internal-mode>` copies a bundled mode YAML from SERENAS_OWN_MODE_YAMLS_DIR as a template for a custom mode. If the requested internal mode yml does not exist in that directory, it raises FileNotFoundError listing all registered mode names. This prevents creating a custom mode from a nonexistent base.","triggerScenarios":"Running `serena mode create <name> --from <internal>` where `<internal>.yml` is absent from Serena's own resources/src/resources/config/modes directory (typo or mode removed in a newer version); the fallback template mode.template.yml is also missing (broken installation).","commonSituations":"Typos in internal mode names (e.g. 'interactive-editor' misspelled); copying a command from an outdated tutorial for a mode that no longer ships; incomplete pip install where resource files are missing.","solutions":["List valid bases with the 'Available modes' names in the error, or inspect Serena's resources/config/modes directory, and retry with an exact name.","Omit --from to start from the generic mode.template.yml.","Reinstall Serena (pip install -U serena-agent / reinstall package) if resource files are missing; report a bug if the template itself is absent."],"exampleFix":"// before\nserena mode create my-mode --from interactiv-editing\n// after\nserena mode create my-mode --from interactive-editor   # or omit --from","handlingStrategy":"validation","validationCode":"import os\nfrom serena.constants import SERENAS_OWN_MODE_YAMLS_DIR\ndef internal_mode_exists(name: str) -> bool:\n    src = os.path.join(SERENAS_OWN_MODE_YAMLS_DIR, f\"{name}.yml\")\n    return os.path.exists(src)","typeGuard":null,"tryCatchPattern":"try:\n    create_mode(name, from_internal=base)\nexcept FileNotFoundError:\n    log.error('Unknown base mode %r; use one of %s or omit --from', base, SerenaAgentMode.list_registered_mode_names())","preventionTips":["Copy internal mode names exactly from the 'Available modes' list or the resources/config/modes directory.","Omit --from when you just want a starter template (mode.template.yml).","Check mode names against the installed Serena version's docs, not older tutorials."],"tags":["cli","modes","file-not-found","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}