Skip to content

search_code returns 0 results for .mjs files #197

@tomerikjansen-crypto

Description

@tomerikjansen-crypto

Description

search_code returns zero results for any pattern searched in .mjs (ES module) files, even though the files are indexed and search_graph finds nodes within them.

Environment

  • Version: 0.5.7 (upgraded from 0.4.10, same issue on both)
  • OS: Windows 11 Pro 10.0.26300
  • Project: Mixed codebase — Python (.py), JavaScript (.mjs, .jsx, .js), Markdown

Steps to Reproduce

  1. Index a repository containing .mjs files (Express server routes in our case)
  2. Run search_code with a pattern that exists in those files
{
  "pattern": "router.get",
  "project": "my-project",
  "path_filter": "dashboard/server",
  "mode": "compact",
  "limit": 10
}

Result: {"results":[], "total_grep_matches": 0, "total_results": 0}

  1. Verify with native grep — the pattern exists in 9 files (25 occurrences):
server/routes/archive.mjs:1
server/routes/hurtiglogg.mjs:3
server/routes/projects.mjs:4
server/routes/tidslinje.mjs:2
server/routes/economics.mjs:6
server/routes/epost.mjs:1
server/routes/planner.mjs:2
server/routes/system.mjs:2
server/routes/tasks.mjs:4

Additional patterns tested (all return 0 for .mjs)

  • asyncHandler — used in 40+ route handlers across .mjs files → 0 results
  • router.post → 0 results
  • process.env → 0 results (when filtered to *.mjs)

What works

  • search_graph with label: Route returns nodes from .mjs files — so indexing parses them correctly
  • search_code works for .py and .js files
  • Native grep/ripgrep finds all patterns correctly

Likely cause

The internal grep in search_code may not include .mjs in its list of recognized JavaScript file extensions, so it skips these files entirely during the text search phase. The graph indexer (tree-sitter) handles them fine.

Workaround

Using the file_pattern parameter with *.mjs also returns 0, so there is no workaround within the tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edges

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions