oraios/serena · error · ValueError

Serena config file not found

Error message

Serena config file not found

What it means

The `/get_serena_config` endpoint reads and returns the Serena configuration file. `_get_serena_config` raises ValueError('Serena config file not found') when `serena_config.config_file_path` is None (no path configured) or the path does not exist on disk. This happens when Serena runs in a mode where no global config file was created.

Source

Thrown at src/serena/dashboard.py:699

                raise ValueError("No active project")
            project.memory_manager.delete_memory(request_delete_memory.memory_name, is_tool_context=False)

        self._agent.execute_task(run, logged=True, name="DeleteMemory")

    def _rename_memory(self, request_rename_memory: RequestRenameMemory) -> str:
        def run() -> str:
            project = self._agent.get_active_project()
            if project is None:
                raise ValueError("No active project")

            return project.memory_manager.move_memory(request_rename_memory.old_name, request_rename_memory.new_name, is_tool_context=False)

        return self._agent.execute_task(run, logged=True, name="RenameMemory")

    def _get_serena_config(self) -> ResponseGetSerenaConfig:
        config_path = self._agent.serena_config.config_file_path
        if config_path is None or not os.path.exists(config_path):
            raise ValueError("Serena config file not found")

        with open(config_path, encoding="utf-8") as f:
            content = f.read()

        return ResponseGetSerenaConfig(content=content)

    def _save_serena_config(self, request_save_config: RequestSaveSerenaConfig) -> None:
        def run() -> None:
            config_path = self._agent.serena_config.config_file_path
            if config_path is None:
                raise ValueError("Serena config file path not set")

            with open(config_path, "w", encoding="utf-8") as f:
                f.write(request_save_config.content)

        self._agent.execute_task(run, logged=True, name="SaveSerenaConfig")

    # ===== Remote News Methods =====

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Initialize Serena once (run any command that generates the default config) so `~/.serena/serena_config.yml` is created, then retry.
  2. Check the resolved `config_file_path` (via the Serena config API or logs) and verify it exists with os.path.exists.
  3. Recreate the config file from the project's default template if it was deleted.
  4. Fix HOME/XDG_CONFIG_HOME or path overrides pointing to the wrong location in containers/CI.

Example fix

# before
cfg = requests.get(f"{dashboard}/get_serena_config").json()
# after
if os.path.exists(config_file_path):
    cfg = requests.get(f"{dashboard}/get_serena_config").json()
else:
    init_default_config()  # create ~/.serena/serena_config.yml first
Defensive patterns

Strategy: validation

Validate before calling

import os
cfg_path = agent.serena_config.config_file_path
if cfg_path is None or not os.path.exists(cfg_path):
    # skip the /get_serena_config call or initialize the default config first
    init_serena_config()

Try / catch

try:
    resp = requests.get(f"{dashboard}/get_serena_config")
    resp.raise_for_status()
except (ValueError, requests.HTTPError) as e:
    logger.warning("Serena config unavailable, using defaults: %s", e)
    config_content = DEFAULT_SERENA_CONFIG

Prevention

When it happens

Trigger: Calling GET /get_serena_config when: (a) Serena has never generated a config file (config_file_path is None), or (b) the configured path was deleted/moved, or points at a non-existent location (e.g. wrong HOME/XDG path).

Common situations: Fresh installs before the first config write; running in containers/CI where HOME differs and the config was never initialized; users deleting `~/.serena/serena_config.yml`; overridden config paths that don't exist.

Related errors


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