{"record":{"id":"c1df8a2493cc598f","repo":"oraios/serena","slug":"name-path-pattern-must-not-be-empty-or-contain-onl","errorCode":null,"errorMessage":"name_path_pattern must not be empty or contain only wildcards; consider using the overview tool","messagePattern":"name_path_pattern must not be empty or contain only wildcards; consider using the overview tool","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/serena/tools/jetbrains_tools.py","lineNumber":86,"sourceCode":"            about the symbol.\n            Default False; info is never included for child symbols or if include_body is True.\n        :param search_deps: If True, also search in project dependencies (e.g., libraries).\n        :param max_matches: Maximum number of permitted matches. If exceeded, a shortened result is returned\n             which allows refining the search. -1 (default) means no limit. Set to 1 if you search for a single symbol.\n        :param max_answer_chars: max characters for the result (-1 for default). If exceeded, no content/a shortened result is returned.\n        :return: symbols matching the name.\n        \"\"\"\n        # check input\n        # - pattern with only wildcards is invalid, but in some cases we delegate to the overview tool\n        if name_path_pattern.replace(\"*\", \"\").replace(\"/\", \"\") == \"\":\n            if relative_path:\n                if self.project.relative_path_exists(relative_path, require_file=True):\n                    overview_tool = self.agent.get_tool(JetBrainsGetSymbolsOverviewTool)\n                    overview_response = overview_tool.apply(relative_path, depth=depth)\n                    return self._wrapped_tool_response(\n                        overview_response, f\"Wildcard-only pattern not admitted; used {overview_tool.get_name()} instead\"\n                    )\n            raise ValueError(\"name_path_pattern must not be empty or contain only wildcards; consider using the overview tool\")\n\n        if include_body:\n            depth = 0  # ignore user-specified depth if body is requested\n\n        name_path_pattern = self._sanitize_input_param(name_path_pattern)\n\n        if relative_path:\n            relative_path = self._sanitize_input_param(relative_path)\n        if relative_path == \".\":\n            relative_path = None\n\n        if relative_path is not None and relative_path.startswith(jb.JB_EXTERNAL_FILE_PREFIX):\n            search_deps = True\n\n        with JetBrainsPluginClient.from_project(self.project) as client:\n            if include_body:\n                include_quick_info = False\n                include_documentation = False","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/tools/jetbrains_tools.py#L68-L104","documentation":"JetBrains find_symbol tool rejects a name_path_pattern that is empty or consists only of wildcard characters (e.g. '*' or '**'). Such a pattern would match everything, so the tool refuses it and points the caller to the dedicated symbols-overview tool, or (when a wildcard-only pattern is combined with an existing relative_path) automatically substitutes the overview tool's response.","triggerScenarios":"Calling JetBrainsFindSymbolTool.apply with name_path_pattern='' or name_path_pattern='*' / '**' (only wildcards, no literal text), or omitting the parameter entirely so sanitization leaves it empty.","commonSituations":"LLM/agent calls find_symbol wanting 'all symbols in a file' instead of a specific name; refactoring a caller that previously passed a bare '*'; building a dynamic query where the user-supplied name part was stripped out leaving only wildcards.","solutions":["Call the symbols-overview tool (JetBrainsGetSymbolsOverviewTool) with the file's relative_path instead of find_symbol","Include at least one non-wildcard literal substring in name_path_pattern, e.g. 'MyClass*' instead of '*'","If you need a directory-wide listing, pass a real relative_path so the wildcard-only branch can redirect to the overview tool automatically"],"exampleFix":"// before\nfind_symbol.apply(name_path_pattern='*', relative_path='src/foo.py')\n// raises ValueError\n\n// after\noverview = agent.get_tool(JetBrainsGetSymbolsOverviewTool)\nresult = overview.apply('src/foo.py', depth=1)\n# or\nfind_symbol.apply(name_path_pattern='MyClass*', relative_path='src/foo.py')","handlingStrategy":"validation","validationCode":"def valid_name_pattern(p: str) -> bool:\n    stripped = p.replace('*', '').replace('?', '')\n    return bool(p and p.strip() and stripped.strip())\nif not valid_name_pattern(name_path_pattern):\n    result = overview_tool.apply(relative_path, depth=depth)\nelse:\n    result = find_symbol_tool.apply(name_path_pattern=name_path_pattern, ...)","typeGuard":"def is_literal_pattern(p: str | None) -> bool:\n    return isinstance(p, str) and bool(p.strip(' *?'))","tryCatchPattern":null,"preventionTips":["Never pass wildcard-only patterns to find_symbol; use the overview tool for 'list everything'","Always include a literal substring in the pattern","Sanitize user/LLM-supplied names and reject empty results early"],"tags":["python","validation","jetbrains","symbols"],"backgroundTag":"empty-or-wildcard-only-pattern","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}