{"record":{"id":"d3c4e876c5531408","repo":"oraios/serena","slug":"no-active-project-ask-the-user-to-provide-the-pro","errorCode":null,"errorMessage":"No active project. Ask the user to provide the project path or to select a project from this list of known projects: {self.agent.serena_config.project_names}","messagePattern":"No active project\\. Ask the user to provide the project path or to select a project from this list of known projects: (.+?)","errorType":"exception","errorClass":"ToolCallError","httpStatus":null,"severity":"error","filePath":"src/serena/tools/tools_base.py","lineNumber":369,"sourceCode":"            except Exception as e:\n                log.info(f\"Failed to get client info: {e}.\")\n\n        def task() -> str:\n            apply_fn = self.get_apply_fn()\n\n            try:\n                if not self.is_active():\n                    raise ToolCallError(\n                        f\"Tool '{self.get_name_from_cls()}' is not active. Active tools: {self.agent.get_active_tool_names()}\"\n                    )\n\n                if log_call:\n                    self._log_tool_application(inspect.currentframe(), session_id)\n\n                # check whether the tool requires an active project and language server\n                if not isinstance(self, ToolMarkerDoesNotRequireActiveProject):\n                    if self.agent.get_active_project() is None:\n                        raise ToolCallError(\n                            \"No active project. Ask the user to provide the project path or to select a project from this list of known projects: \"\n                            + f\"{self.agent.serena_config.project_names}\"\n                        )\n\n                # construct apply kwargs, adding session_id if the tool is session-aware\n                apply_kwargs = dict(kwargs)\n                if self._is_session_aware:\n                    apply_kwargs[\"session_id\"] = session_id\n\n                # apply the actual tool\n                try:\n                    result = apply_fn(**apply_kwargs)\n                except SolidLSPException as e:\n                    if e.is_language_server_terminated():\n                        affected_language = e.get_affected_language()\n                        if affected_language is not None:\n                            log.error(\n                                f\"Language server terminated while executing tool ({e}). Restarting the language server and retrying ...\"","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/tools/tools_base.py#L351-L387","documentation":"Tools that require project context (anything not marked ToolMarkerDoesNotRequireActiveProject) fail in task() when the agent has no active project loaded. The error tells the caller to ask the user for a project path or choose from serena_config.project_names.","triggerScenarios":"Calling any file/symbol/memory tool before select_project/onboarding; the active project was deactivated; a fresh agent session where no project was ever set.","commonSituations":"Chat starts and the agent immediately calls find_file without activating a project; multi-project setups where the wrong agent instance is used; project activation failed silently earlier.","solutions":["Activate a project first (agent.select_project('/path/to/project') or the activate_project tool)","Ask the user for the project path and load it before issuing tool calls","Pick a project from agent.serena_config.project_names (the message lists known ones)","Use a tool marked as not requiring an active project if that fits the intent"],"exampleFix":"// before\nagent.get_tool(ListDirTool).apply(path='src')  # no active project\n// ToolCallError: No active project...\n\n// after\nagent.get_tool(ActivateProjectTool).apply(project='/home/me/myrepo')\nagent.get_tool(ListDirTool).apply(path='src')","handlingStrategy":"validation","validationCode":"if agent.get_active_project() is None:\n    known = agent.serena_config.project_names\n    raise NeedProjectInput(f'select one of: {known}')\nresult = tool.apply(...)","typeGuard":null,"tryCatchPattern":"try:\n    result = tool.apply(...)\nexcept ToolCallError as e:\n    if 'No active project' in str(e):\n        agent.get_tool(ActivateProjectTool).apply(project=ask_user_or_pick())\n        result = tool.apply(...)\n    else:\n        raise","preventionTips":["Activate a project at session start before any project-scoped tool call","Wrap tool dispatch to lazily activate the last-used project","For project-independent work, use tools marked ToolMarkerDoesNotRequireActiveProject"],"tags":["python","configuration","project","serena"],"backgroundTag":"no-active-project","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}