oraios/serena · error · ValueError

Serena config file path not set

Error message

Serena config file path not set

What it means

The save-config handler (`_save_serena_config`) writes the posted content to `serena_config.config_file_path`. If that path is None — Serena was started without a config file location (no global config has ever been created/resolved) — it raises ValueError('Serena config file path not set') and nothing is written.

Source

Thrown at src/serena/dashboard.py:710

            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 =====

    # The branch from which news are fetched. Change to a feature branch for testing.
    _NEWS_JSON_URL = "https://oraios-software.de/serena_news.json"

    def _fetch_news(self) -> None:
        """Fetch news.json from GitHub using ETag-based caching and store in memory. Silently ignores network errors."""
        paths = SerenaPaths()

        headers: dict[str, str] = {}
        # Load stored ETag if available
        if os.path.exists(paths.news_etag_file) and os.path.exists(paths.news_file):

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Ensure the global config file exists (run Serena once to generate `~/.serena/serena_config.yml` or create it manually) before saving via the dashboard.
  2. Verify HOME/XDG path overrides resolve to the location Serena reads its config from.
  3. Initialize the config via Serena's config-loading API so config_file_path is populated, then retry the save.
  4. If the file exists but the error persists, restart the agent so it reloads the config path.

Example fix

# before
requests.put(f"{dashboard}/save_serena_config", json={"content": cfg_text})
# after
Path("~/.serena/serena_config.yml").expanduser().parent.mkdir(parents=True, exist_ok=True)
if not Path("~/.serena/serena_config.yml").expanduser().exists():
    Path("~/.serena/serena_config.yml").expanduser().write_text(default_config)
requests.put(f"{dashboard}/save_serena_config", json={"content": cfg_text})
Defensive patterns

Strategy: validation

Validate before calling

import os
path = agent.serena_config.config_file_path
assert path is not None, "Serena config path not set; create the global config first"
if not os.path.exists(path):
    Path(path).parent.mkdir(parents=True, exist_ok=True)
    Path(path).write_text(default_config_yaml)

Try / catch

try:
    requests.put(f"{dashboard}/save_serena_config", json={"content": new_yaml})
except ValueError as e:
    if "path not set" in str(e):
        create_default_config_file()
        requests.put(f"{dashboard}/save_serena_config", json={"content": new_yaml})

Prevention

When it happens

Trigger: PUT /save_serena_config in an environment where the Serena config path was never resolved: fresh state with no `~/.serena/serena_config.yml`, or a config object constructed without a file path. Note this differs from error [66]: here the path is None, not merely missing on disk.

Common situations: Editing config through the dashboard in a container/CI where Serena never initialized its global config; HOME set to a location where no config exists and none was generated; testing the dashboard against an in-memory config.

Related errors


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