{"record":{"id":"2a5f03b174198e72","repo":"oraios/serena","slug":"project-root-not-found-project-root","errorCode":null,"errorMessage":"Project root not found: {project_root}","messagePattern":"Project root not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/config/serena_config.py","lineNumber":441,"sourceCode":"        \"\"\"\n        Autogenerate a project configuration for a given project root.\n\n        :param project_root: the path to the project root\n        :param serena_config: the global Serena configuration\n        :param project_name: the name of the project; if None, the name of the project will be the name of the directory\n            containing the project\n        :param languages: the languages of the project; if None, they will be determined automatically\n        :param save_to_disk: whether to save the project configuration to disk\n        :param interactive: whether to run in interactive CLI mode, asking the user for input where appropriate\n        :param asynchronous: whether to run in asynchronous mode, where time-consuming configuration parts (currently only the\n            determination of the list of programming languages) are determined in a background thread and initialised as empty\n        :return: the project configuration\n        \"\"\"\n        if interactive and asynchronous:\n            raise ValueError(\"Cannot use interactive mode with asynchronous auto-generation\")\n        project_root = Path(project_root).resolve()\n        if not project_root.exists():\n            raise FileNotFoundError(f\"Project root not found: {project_root}\")\n        with LogTime(\"Project configuration auto-generation\", logger=log):\n            log.info(\"Project root: %s\", project_root)\n            project_folder_name = project_root.name\n            project_name = project_name or project_folder_name\n            use_asynchronous_language_determination = False\n            if languages is None:\n                if asynchronous:\n                    use_asynchronous_language_determination = True\n                    languages_to_use = []  # temporarily empty, will be determined in background thread\n                else:\n                    determined_languages = cls._determine_project_language_servers(\n                        str(project_root), interactive=interactive, serena_config=serena_config\n                    )\n                    languages_to_use = [l.value for l in determined_languages]\n            else:\n                languages_to_use = [lang.value for lang in languages]\n            config_with_comments, _ = cls._load_yaml_dict(PROJECT_TEMPLATE_FILE)\n            config_with_comments[\"project_name\"] = project_name","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/config/serena_config.py#L423-L459","documentation":"Serena's ProjectConfig.autogenerate() resolves the given project_root path and raises FileNotFoundError when that directory does not exist on disk. The library refuses to auto-generate a project configuration file (.serena/project.yml) for a non-existent root, since language detection and file scanning depend on a real directory. The message includes the resolved absolute path so you can see exactly what was looked for.","triggerScenarios":"Calling ProjectConfig.autogenerate(project_root=...) (directly or via ProjectConfig.load or _create_project) with a path that does not exist after Path(project_root).resolve() — e.g. a typo, a deleted/moved directory, or a relative path resolved against the wrong working directory. Also triggered by tests test_autogenerate_empty_directory and friends when the fixture root is absent.","commonSituations":"Passing a path relative to a different CWD than expected (IDE vs CLI), a project folder that was renamed or removed, a typo like './my-projet', or constructing the path from an env var that is unset. Also common when creating a brand-new project: users point autogenerate at a folder they intend to create rather than one that exists.","solutions":["Verify the directory exists (ls the resolved path printed in the message) and fix typos in the path","Create the directory first (mkdir -p <root>) if you intend to initialize a new project there","Pass an absolute path or resolve relative paths against the correct working directory before calling autogenerate/load","If the folder moved, update the path in whatever config/CLI/IDE setting references it"],"exampleFix":"// before\nconfig = ProjectConfig.autogenerate(project_root=\"~/code/my-projet\", interactive=False)\n// after\nroot = Path(\"~/code/my-project\").expanduser().resolve()\nassert root.exists(), f\"missing project root: {root}\"\nconfig = ProjectConfig.autogenerate(project_root=str(root), interactive=False)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nroot = Path(project_root).expanduser().resolve()\nif not root.is_dir():\n    raise SystemExit(f\"Project root does not exist: {root}. Create it or fix the path before calling autogenerate.\")","typeGuard":"def project_root_exists(path: str | Path) -> bool:\n    p = Path(path).expanduser().resolve()\n    return p.exists() and p.is_dir()","tryCatchPattern":"try:\n    config = ProjectConfig.autogenerate(project_root=str(root), interactive=False)\nexcept FileNotFoundError as e:\n    logger.error(\"Project root missing: %s — create it with mkdir -p or correct the path\", e)\n    raise","preventionTips":["Always pass an absolute, expanduser()-resolved path to autogenerate/load","assert Path(root).exists() before configuring Serena in scripts","Create the project directory (mkdir -p) before initializing Serena config for a new project","Beware CWD differences between IDE and CLI — anchor relative paths to a known base"],"tags":["python","filesystem","path-not-found","configuration"],"backgroundTag":"path-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}