oraios/serena · error · FileNotFoundError

Internal mode '{name}' not found in {INTERNAL_MODE_YAMLS_DIR

Error message

Internal mode '{name}' not found in {INTERNAL_MODE_YAMLS_DIR}

What it means

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.

Source

Thrown at src/serena/config/context_mode.py:113

        if not os.path.exists(own_yaml_path):
            raise FileNotFoundError(
                f"Mode {name} not found in {SerenaPaths().user_modes_dir} or in {SERENAS_OWN_MODE_YAMLS_DIR}."
                f"Available modes:\n{cls.list_registered_mode_names()}"
            )
        return own_yaml_path

    @classmethod
    def from_name(cls, name: str) -> Self:
        """Load a registered Serena mode."""
        mode_path = cls.get_path(name)
        return cls.from_yaml(mode_path)

    @classmethod
    def from_name_internal(cls, name: str) -> Self:
        """Loads an internal Serena mode"""
        yaml_path = os.path.join(INTERNAL_MODE_YAMLS_DIR, f"{name}.yml")
        if not os.path.exists(yaml_path):
            raise FileNotFoundError(f"Internal mode '{name}' not found in {INTERNAL_MODE_YAMLS_DIR}")
        return cls.from_yaml(yaml_path)

    @classmethod
    def list_registered_mode_names(cls, include_user_modes: bool = True) -> list[str]:
        """Names of all registered modes (from the corresponding YAML files in the serena repo)."""
        modes = [f.stem for f in Path(SERENAS_OWN_MODE_YAMLS_DIR).glob("*.yml") if f.name != "mode.template.yml"]
        if include_user_modes:
            modes += cls.list_custom_mode_names()
        return sorted(set(modes))

    @classmethod
    def list_custom_mode_names(cls) -> list[str]:
        """Names of all custom modes defined by the user."""
        return [f.stem for f in Path(SerenaPaths().user_modes_dir).glob("*.yml")]

    @classmethod
    def load(cls, name_or_path: str | Path) -> Self:
        # If it is a path or looks like a path, load from file

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Reinstall/repair Serena (pip install --force-reinstall serena) so bundled YAML resources are restored
  2. Remove or correct the internal mode name in your config/active modes
  3. Check you're not shadowing the package resources (run from a clean checkout, verify INTERNAL_MODE_YAMLS_DIR exists)
  4. Downgrade/upgrade to a Serena version that includes that internal mode

Example fix

// before (config)
active_modes: [chat_internal_missing]
// after
active_modes: [chat_internal]  # mode that exists in INTERNAL_MODE_YAMLS_DIR
Defensive patterns

Strategy: validation

Validate before calling

from serena.config.context_mode import INTERNAL_MODE_YAMLS_DIR
from pathlib import Path
assert (Path(INTERNAL_MODE_YAMLS_DIR) / f"{name}.yml").is_file(), f"Internal mode {name} missing"

Try / catch

try:
    mode = SerenaMode.from_name_internal(name)
except FileNotFoundError as e:
    logger.error("Installation may be broken: %s", e)
    raise SystemExit("Reinstall serena: pip install --force-reinstall serena")

Prevention

When it happens

Trigger: _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.

Common situations: 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.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/b363929006519912. Report an issue: GitHub.