oraios/serena · error · _HealthCheckFailure

No analyzable files found

Error message

No analyzable files found

What it means

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.

Source

Thrown at src/serena/cli.py:974

                log.info("SerenaAgent created successfully")

                # Find first non-empty file that can be analyzed
                log.info("Searching for analyzable files...")
                files = proj.gather_source_files()
                target_file = None

                for file_path in files:
                    try:
                        full_path = os.path.join(project_path, file_path)
                        if os.path.getsize(full_path) > 1000:
                            target_file = file_path
                            log.info("Found analyzable file: %s", target_file)
                            break
                    except (OSError, FileNotFoundError):
                        continue

                if not target_file:
                    raise ProjectCommands._HealthCheckFailure("No analyzable files found")

                # Get tools from agent
                overview_tool = agent.get_tool(GetSymbolsOverviewTool)
                find_symbol_tool = agent.get_tool(FindSymbolTool)
                find_refs_tool = agent.get_tool(FindReferencingSymbolsTool)

                # Test 1: Get symbols overview
                log.info("Testing GetSymbolsOverviewTool on file: %s", target_file)
                overview_data = agent.execute_task(lambda: overview_tool.get_symbol_overview(target_file))
                log.info(f"GetSymbolsOverviewTool returned: {overview_data}")

                if not overview_data:
                    raise ProjectCommands._HealthCheckFailure(f"No symbols found in target file {target_file}")

                # Extract suitable symbol (prefer class or function over variables)
                preferred_kinds = {SymbolKind.Class.name, SymbolKind.Function.name, SymbolKind.Method.name, SymbolKind.Constructor.name}
                selected_symbol = None
                for symbol in overview_data:

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Add at least one source file in a language serena recognizes for this project.
  2. Verify the project's configured languages match the actual files (serena-config or recreate the project with correct --language).
  3. Check the file is readable and not excluded; run `serena project index` first to confirm files are discovered.
  4. Run the health check from the project root so relative paths resolve correctly.

Example fix

// before (empty project)
serena project health-check
# -> "No analyzable files found"
// after
echo 'def hello(): pass' > main.py
serena project health-check
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
has_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)
if not has_source:
    raise SystemExit('Project has no source files; health check would fail')

Try / catch

try:
    run(['serena', 'project', 'health-check'], check=True)
except subprocess.CalledProcessError:
    print('Health check failed: ensure the project contains readable source files')

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/059a058d85d91f9c. Report an issue: GitHub.