{"record":{"id":"fb1b9573e72199e4","repo":"oraios/serena","slug":"cannot-use-interactive-mode-with-asynchronous-auto","errorCode":null,"errorMessage":"Cannot use interactive mode with asynchronous auto-generation","messagePattern":"Cannot use interactive mode with asynchronous auto-generation","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/serena/config/serena_config.py","lineNumber":438,"sourceCode":"        interactive: bool = False,\n        asynchronous: bool = False,\n    ) -> Self:\n        \"\"\"\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:","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/config/serena_config.py#L420-L456","documentation":"ProjectConfig.autogenerate() can run interactively (asking the user questions via CLI) or asynchronously (determining languages in a background thread). These modes are mutually exclusive because background initialization cannot prompt the user, so passing both interactive=True and asynchronous=True raises this ValueError immediately.","triggerScenarios":"Calling ProjectConfiguration.autogenerate(project_root, interactive=True, asynchronous=True), or a code path (e.g. _create_project) that enables interactivity while async auto-generation was requested, including via serena's project creation CLI flags combining an interactive prompt with async generation.","commonSituations":"Scripting project creation with async generation enabled while also passing an interactive flag; combining CLI options like --interactive with an async setting in tooling that wraps autogenerate(); copying a call example and adding a second option.","solutions":["Set asynchronous=False if you want the interactive Q&A flow (language detection happens synchronously).","Set interactive=False (accept defaults) if you want fast asynchronous auto-generation.","If you call autogenerate from your own wrapper, make the two flags mutually exclusive before invoking it.","Resolve the project_root beforehand and confirm it exists, since autogenerate also raises FileNotFoundError otherwise."],"exampleFix":"// before\nconfig = ProjectConfiguration.autogenerate(project_root, interactive=True, asynchronous=True)\n// after\nconfig = ProjectConfiguration.autogenerate(project_root, interactive=True, asynchronous=False)","handlingStrategy":"validation","validationCode":"def validate_autogenerate_args(interactive: bool, asynchronous: bool) -> None:\n    if interactive and asynchronous:\n        raise ValueError(\"interactive and asynchronous are mutually exclusive; pick one.\")\n\n# call before autogenerate:\nvalidate_autogenerate_args(interactive, asynchronous)","typeGuard":"def is_valid_autogenerate_mode(interactive: bool, asynchronous: bool) -> bool:\n    return not (interactive and asynchronous)","tryCatchPattern":"try:\n    config = ProjectConfiguration.autogenerate(project_root, interactive=interactive, asynchronous=asynchronous)\nexcept ValueError as e:\n    if \"interactive\" in str(e):\n        config = ProjectConfiguration.autogenerate(project_root, interactive=True, asynchronous=False)\n    else:\n        raise","preventionTips":["Treat interactive and asynchronous as mutually exclusive flags in wrappers/CLIs.","Default to asynchronous=False for CLI tools where prompting is expected.","Resolve and verify project_root exists before calling autogenerate (it also raises FileNotFoundError).","Centralize flag parsing so conflicting boolean options are rejected at argument-parse time."],"tags":["python","configuration","invalid-arguments"],"backgroundTag":"incompatible-options","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}