{"record":{"id":"059a058d85d91f9c","repo":"oraios/serena","slug":"no-analyzable-files-found","errorCode":null,"errorMessage":"No analyzable files found","messagePattern":"No analyzable files found","errorType":"exception","errorClass":"_HealthCheckFailure","httpStatus":null,"severity":"error","filePath":"src/serena/cli.py","lineNumber":974,"sourceCode":"                log.info(\"SerenaAgent created successfully\")\n\n                # Find first non-empty file that can be analyzed\n                log.info(\"Searching for analyzable files...\")\n                files = proj.gather_source_files()\n                target_file = None\n\n                for file_path in files:\n                    try:\n                        full_path = os.path.join(project_path, file_path)\n                        if os.path.getsize(full_path) > 1000:\n                            target_file = file_path\n                            log.info(\"Found analyzable file: %s\", target_file)\n                            break\n                    except (OSError, FileNotFoundError):\n                        continue\n\n                if not target_file:\n                    raise ProjectCommands._HealthCheckFailure(\"No analyzable files found\")\n\n                # Get tools from agent\n                overview_tool = agent.get_tool(GetSymbolsOverviewTool)\n                find_symbol_tool = agent.get_tool(FindSymbolTool)\n                find_refs_tool = agent.get_tool(FindReferencingSymbolsTool)\n\n                # Test 1: Get symbols overview\n                log.info(\"Testing GetSymbolsOverviewTool on file: %s\", target_file)\n                overview_data = agent.execute_task(lambda: overview_tool.get_symbol_overview(target_file))\n                log.info(f\"GetSymbolsOverviewTool returned: {overview_data}\")\n\n                if not overview_data:\n                    raise ProjectCommands._HealthCheckFailure(f\"No symbols found in target file {target_file}\")\n\n                # Extract suitable symbol (prefer class or function over variables)\n                preferred_kinds = {SymbolKind.Class.name, SymbolKind.Function.name, SymbolKind.Method.name, SymbolKind.Constructor.name}\n                selected_symbol = None\n                for symbol in overview_data:","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/cli.py#L956-L992","documentation":"During `serena project health-check`, serena searches the project for a file it can analyze to exercise the language-server tools. If no analyzable file exists (or none can be located/read), it raises an internal `_HealthCheckFailure` with this message. The health check then reports the project tooling as non-functional.","triggerScenarios":"Running `serena project health-check` on an empty project, a project whose recognized language directories contain no matching source files, or files that fail to read (OSError/FileNotFoundError are skipped during the search).","commonSituations":"Health-checking a freshly initialized/empty repo, a project with only unrecognized file types, misconfigured project languages so serena looks in the wrong place, or files ignored/excluded from indexing.","solutions":["Add at least one source file in a language serena recognizes for this project.","Verify the project's configured languages match the actual files (serena-config or recreate the project with correct --language).","Check the file is readable and not excluded; run `serena project index` first to confirm files are discovered.","Run the health check from the project root so relative paths resolve correctly."],"exampleFix":"// before (empty project)\nserena project health-check\n# -> \"No analyzable files found\"\n// after\necho 'def hello(): pass' > main.py\nserena project health-check","handlingStrategy":"validation","validationCode":"from pathlib import Path\nhas_source = any(p for p in Path('.').rglob('*') if p.suffix in {'.py', '.ts', '.js', '.go', '.rs', '.java'} and p.is_file() and p.stat().st_size > 0)\nif not has_source:\n    raise SystemExit('Project has no source files; health check would fail')","typeGuard":null,"tryCatchPattern":"try:\n    run(['serena', 'project', 'health-check'], check=True)\nexcept subprocess.CalledProcessError:\n    print('Health check failed: ensure the project contains readable source files')","preventionTips":["Only run health checks on projects with at least one non-empty recognized source file.","Confirm the project's configured languages actually match the files present.","Run `serena project index` first to verify files are discovered."],"tags":["cli","health-check","empty-project"],"backgroundTag":"no-analyzable-files","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}