oraios/serena · error · FileNotFoundError

Project configuration file not found: {yaml_path}

Error message

Project configuration file not found: {yaml_path}

What it means

ProjectConfig.load() requires a serena_project.yml (project configuration file) inside the project root. If the file does not exist and auto-generation is disabled, the loader refuses to invent a config and raises FileNotFoundError. It only autogenerates when is_autogen_enabled().

Source

Thrown at src/serena/config/serena_config.py:706

    ) -> Self:
        """
        Load a ProjectConfig instance from the path to the project root.

        :param project_root: the path to the project root
        :param serena_config: the global Serena configuration
        :param autogen: the auto-generation mode to apply if the project configuration does not yet exist
        """
        project_root = Path(project_root)
        project_folder_name = project_root.name
        yaml_path = serena_config.get_project_yml_location(project_root)
        log.debug("Loading project configuration from %s", yaml_path)

        # auto-generate if necessary
        if not os.path.exists(yaml_path):
            if autogen.is_autogen_enabled():
                return cls.autogenerate(project_root, serena_config, asynchronous=autogen == ProjectConfigAutoGenerationMode.ASYNCHRONOUS)
            else:
                raise FileNotFoundError(f"Project configuration file not found: {yaml_path}")

        # load the configuration dictionary
        yaml_data, was_complete = cls._load_yaml_dict(str(yaml_path))
        if "project_name" not in yaml_data:
            yaml_data["project_name"] = project_folder_name

        # apply overrides from project.local.yml, if present
        local_yaml_path = cls._project_local_yml_path(str(yaml_path))
        local_override_keys = []
        if os.path.exists(local_yaml_path):
            local_yaml_data, _ = cls._load_yaml_dict(local_yaml_path, apply_defaults=False)
            if local_yaml_data:
                local_override_keys = list(local_yaml_data.keys())
                log.debug(
                    "Applying project configuration overrides from %s with keys %s",
                    local_yaml_path,
                    local_override_keys,
                )

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Create serena_project.yml in the project root (run `serena project create` or copy the template) and fill in project_name.
  2. Enable project-config autogeneration so load() can create the file automatically.
  3. Verify the path passed actually is the intended project root containing the config.

Example fix

// before
config = ProjectConfig.load(Path('/repos/myproj'))  # no serena_project.yml, autogen off
// after
(Path('/repos/myproj/serena_project.yml')).write_text('project_name: myproj\nlanguage: python\n')
config = ProjectConfig.load(Path('/repos/myproj'))
Defensive patterns

Strategy: fallback

Validate before calling

from pathlib import Path
root = Path(project_root)
if not (root / 'serena_project.yml').exists():
    print('missing project config at', root)  # then enable autogen or create it

Type guard

def has_project_config(root) -> bool:
    from pathlib import Path
    return (Path(root) / 'serena_project.yml').is_file()

Try / catch

try:
    cfg = ProjectConfig.load(root, autogen=ProjectConfigAutoGenerationMode.DISABLED)
except FileNotFoundError:
    cfg = ProjectConfig.autogenerate(root)

Prevention

When it happens

Trigger: Calling ProjectConfig.load(project_root) or SerenaConfig.add_project_from_path(...) on a directory lacking serena_project.yml when ProjectConfigAutoGenerationMode is disabled (or the config file path points elsewhere).

Common situations: Activating a brand-new project that was never onboarded; pointing from_project_root at the wrong directory; running in CI/container where the project yml was not copied; autogen disabled in serena_config.yml.

Related errors


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