Skip to content

Windows: get_code_snippet returns "(source not available)" and search_code returns 0 matches for projects indexed under non-ASCII (CJK) paths — indexing itself succeeds #903

Open

Description

@Rakua-Laqua

Environment

Summary

With current main, indexing a repository whose path contains non-ASCII (CJK) characters now works:
index_repository spawns workers cleanly, symbols (Class/Method/Function) are fully extracted, and
the project name encodes non-ASCII bytes as UTF-8 hex.

However, the tools that re-read files from disk at query time still fail for such projects:

Tool Result on CJK-path project Result on same repo via ASCII junction
index_repository (full) ✅ nodes/edges identical to junction ✅
search_graph / query_graph ✅ symbols, signatures, complexity all present ✅
get_code_snippet ⚠️ metadata OK (start/end line, signature), but "source": "(source not available)" ✅ full source returned
search_code ❌ 0 matches for any pattern ✅ matches returned

So extraction-time file reads work, but the query-time read path (snippet source load, grep) apparently
still goes through a narrow-char API and fails on CJK paths.

Repro

mkdir C:\tmp\repro-日本語
@'
def multiply(a, b):
    return a * b

class Calculator:
    def square(self, x):
        return multiply(x, x)
'@ | Set-Content C:\tmp\repro-日本語\util.py -Encoding utf8

codebase-memory-mcp cli index_repository --repo-path "C:/tmp/repro-日本語" --mode fast
# -> status:"indexed", project "C-tmp-repro-e697a5e69cace8aa9e", symbols present:
codebase-memory-mcp cli query_graph --args-file <(echo '{"query":"MATCH (c:Class) RETURN c.name","project":"C-tmp-repro-e697a5e69cace8aa9e"}')
# -> Calculator ... (extraction works)

codebase-memory-mcp cli get_code_snippet --qualified-name Calculator --project C-tmp-repro-e697a5e69cace8aa9e
# -> "source": "(source not available)"   <-- BUG (line range + signature are correct)

codebase-memory-mcp cli search_code --pattern multiply --project C-tmp-repro-e697a5e69cace8aa9e
# -> 0 matches                            <-- BUG

Create an ASCII junction to the same directory (New-Item -ItemType Junction), index via the junction
path: both get_code_snippet source and search_code work, on identical file content.

Verified on a real C# repo as well (56 classes / 280 methods extracted from the CJK path — identical
counts to the junction index — yet snippet source and search_code only work on the junction project).

Expected

get_code_snippet returns the source text and search_code returns matches for projects indexed
under non-ASCII paths, same as for ASCII paths.

Notes / suspected cause

Workaround

Index through an ASCII junction/symlink to the repo; all tools work via the aliased path.

Activity

  1. added
    bugSomething isn't working
    windowsWindows-specific issues
    ux/behaviorDisplay bugs, docs, adoption UX
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    on Jul 7, 2026
  2. DeusData commented on Jul 7, 2026

    @DeusData
    Owner

    Thanks for the Windows non-ASCII path retest on current main. Triage: high-priority Windows query/file-read bug under #394.

    It is useful that indexing now succeeds and only query-time disk reads fail. The fix should target the file re-open paths used by get_code_snippet and search_code, with a CJK-path regression proving indexed metadata and source retrieval both work.

  3. added this to the 0.9.1-rc milestone on Jul 8, 2026
  4. DeusData commented on Sep 26, 2026

    @DeusData
    Owner

    Thank you, @Rakua-Laqua, for the side-by-side junction comparison! Pinning the failure to query-time reads made the root cause easy to find.

    The snippet read itself already used the wide-path _wfopen, but the containment check in front of it resolved paths with the ANSI _fullpath. On code page 932 that can't round-trip a CJK path, so the check refused the file and you got "(source not available)". Wide-path canonicalisation (#973) replaced it, and search_code got its UTF-8 fix in #956. Both shipped in v0.10.0.

    Could you rerun your repro-日本語 steps on v0.11.0, without the junction, and confirm that both get_code_snippet and search_code return content?

  5. added
    awaiting-reporterWaiting on the reporter for info/repro; stale bot will warn then close
    on Sep 26, 2026
  6. github-actions commented on Sep 26, 2026

    @github-actions

    Thanks for the report! To move this forward we need a bit more so we can reproduce it ourselves:

    • the codebase-memory-mcp --version you're on
    • the exact steps or command you ran
    • a public repo (or a small dummy snippet) that shows the problem — please don't paste proprietary code

    Once that's here we'll pick it straight back up. Heads-up: issues left awaiting-reporter are automatically closed after a few weeks of silence, but a comment reopens the door anytime.

  7. github-actions commented on Oct 18, 2026

    @github-actions

    This issue has been waiting on more information for 21 days (a version, exact steps, or a public repro), so it's now marked stale. It will not be closed automatically — a maintainer reviews stale issues by hand. Adding a comment with the details clears the label and puts it straight back in the queue. We're happy to pick it back up the moment we can reproduce it.

  8. added
    staleNo activity after an info request; will be closed soon
    on Oct 18, 2026
  9. DeusData commented on Oct 19, 2026

    @DeusData
    Owner

    Thank you again for the CJK-path comparison. Checking back on the September retest request: do both snippet retrieval and text search now work without the ASCII junction on your current version? Please include the version if you can retest; I have no fresh result to claim this resolved on your machine.

  10. removed
    staleNo activity after an info request; will be closed soon
    on Oct 20, 2026
  11. DeusData commented on Oct 25, 2026

    @DeusData
    Owner

    Thank you again for the report. If you have a newer CJK-path retest result, please share the version and whether snippet retrieval and search both work without the ASCII junction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-reporterWaiting on the reporter for info/repro; stale bot will warn then closebugSomething isn't workingpriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.ux/behaviorDisplay bugs, docs, adoption UXwindowsWindows-specific issues

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions