Repository navigation
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
(because of the network problem, I can't work with CodeSandbox and StackBlitz, but it can reproduce in the clean new project) - I have read the console error message carefully (if applicable).
Description
- In a fresh Docusaurus project on Windows using npm, creating
docs/contribute/index.mdxworks fine. - However, moving that same file into
docs/contribute/vulnerability-report/index.mdxcauses the build to fail.

- Renaming the folder
vulnerability-reporttofoo-barresolves the issue.

- Moving the file back to
docs/contribute/index.mdxalso resolves it. The problem occurs with both.mdxand.mdextensions. - Moving the file back to
docs/contribute/vulnerability-report/index.mdxagain, the build fail again.
Reproducible demo
Steps to reproduce
-
Create a new Docusaurus project using npm on Windows:
npx create-docusaurus@latest my-website classic --typescript cd my-website npm install -
Create a file
docs/contribute/index.mdxwith any content (e.g.,# Test). -
Run
npm start– the site builds successfully and the doc displays at/docs/contribute. -
Stop the server. Move the file into a new subdirectory
vulnerability-report:mkdir docs\contribute\vulnerability-report move docs\contribute\index.mdx docs\contribute\vulnerability-report\index.mdx
Then run
npm start– build fails (error details below). -
Stop the server. Clean the cache and dependencies:
rmdir /s /q .docusaurus rmdir /s /q node_modules npm install
After reinstallation, run
npm startagain – the error still occurs. -
Stop the server. Rename the
vulnerability-reportfolder tofoo-bar:move docs\contribute\vulnerability-report docs\contribute\foo-bar
Run
npm start– the build now works correctly. -
Stop the server. Move the file back to
docs/contribute/index.mdx:move docs\contribute\foo-bar\index.mdx docs\contribute\index.mdx
Run
npm start– the build works correctly again. -
(Optional) Repeat the same steps using a
.mdfile instead of.mdx– the problem is reproducible exactly the same way.
Expected behavior
The build should succeed, and the doc should be accessible at /docs/contribute/vulnerability-report without any hash mismatch. Deleting .docusaurus and node_modules should not be necessary for a correct build.
Actual behavior
When the file is located at docs/contribute/vulnerability-report/index.mdx, the build fails with a module resolution error:
× Cannot find module '@site/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-contribute-vulnerability-report-index-mdx-e58.json' for matched aliased key '@site'
Meanwhile, inside .docusaurus/docusaurus-plugin-content-docs/default/, the actual generated file is:
site-docs-contribute-vulnerability-report-index-mdx-b66.json
Notice the hash mismatch: looking for -e58 but the file exists with -b66.
Your environment
- Public source code: https://github.com/coder-xiaomo/docusaurus-bug-minimal-repro/commits/main/
- Public site URL:
- Docusaurus version used: latest (3.10.1)
- Environment name and version: Microsoft Edge 147.0.3912.98; Node.js v24.14.1
- Operating system and version: Windows 11
Self-service
- I'd be willing to fix this bug myself. (but I am not sure where the root cause is. If the root cause was found, maybe I can create an pull request to fix it)
Activity
zhang-brook commentedon May 14, 2026
I have now identified the root cause. My file directory contains two invisible characters.

In Docusaurus v3, these invisible characters were ignored and the build worked normally. After upgrading to v4, it seems that when generating files and when locating files by filename, the presence of these special characters causes inconsistent hashes in the generated
docs-<hash>.jsonfiles – the hash used to look up the file does not match the actual hash of the generated file. This results in a build failure.@slorber I suggest adding validation for special/invisible characters in file paths.
In this case, the problematic folder name (contains invisible characters):
[vulnerability-report](betweentand])The correct folder name (no invisible characters):
[vulnerability-report]danyalahmed1995 commentedon May 20, 2026
Hey I tried to reproduce this on my system.
Setup:
The interesting part is that the failing folder name is not plain ASCII. In the repro repo, the folder is:
vulnerability-report<U+200B><U+200B>so there are two trailing zero-width spaces after
report.The build writes:
site-docs-contribute-vulnerability-report-index-mdx-b66.jsonbut the MDX metadata import asks for:
site-docs-contribute-vulnerability-report-index-mdx-e58.jsonI also checked a fresh controlled project: plain
docs/contribute/vulnerability-report/index.mdxpasses, but the same path withU+200Breproduces the mismatch. So this looks less like a route/sidebar/cache issue and more like hidden Unicode path handling between docs metadata generation and the MDX loader metadata import.I think this should be addressed , maintainers feedback would be appreciated . I will see if i can open a PR for it
danyalahmed1995 commentedon May 21, 2026
To narrowing this down to the invisible characters. I opened #12044 with a small fix for this.
I checked the repro more deeply and confirmed the failing folder is:
vulnerability-report<U+200B><U+200B>with two trailing zero-width spaces.
The reason I did not go with validation-only is that Docusaurus v3 apparently handled this, and the actual failure is not just “invalid path exists”. The build writes metadata using one source string:
site-docs-contribute-vulnerability-report-index-mdx-b66.jsonbut the MDX loader imports metadata using another:
site-docs-contribute-vulnerability-report-index-mdx-e58.jsonSo the PR makes the MDX metadata import resolve back to the loaded docs source before hashing, keeping both sides in sync.
I also added a guard for ambiguous cases where paths only differ by
U+200B, so Docusaurus reports the ambiguity clearly instead of silently picking the wrong metadata source.The normal ASCII path still works, and the zero-width-space repro now passes in the controlled/manual checks.
slorber commentedon May 21, 2026
FYI, Docusaurus v4 doesn't exist yet. Are you using a canary version? It's unclear which version worked, and when it stopped working. Please share valid and stable version numbers so we can look at the diff.
Here's an end-to-end repro PR with this problem, the goal is to make this pass with a good solution: #12052
Agree that there is a hash mismatch somewhere, but I don't find the PR above very attractive and generic. The problem is likely to affect all our content plugins, and may also affect third-party plugins, so a generic solution would be better.
Before implementing anything, we must understand what the hashes are different.
danyalahmed1995 commentedon May 21, 2026
So I traced the two hash inputs locally with the dogfood repro.
Interestingly metadata writer hashes the loaded docs source, which preserves both zero-width spaces:
@site/_dogfooding/_docs tests/tests/zero-width-spaces/vulnerability-report<U+200B><U+200B>/index.mdxThat produces the written metadata file:
site-dogfooding-docs-tests-tests-zero-width-spaces-vulnerability-report-index-mdx-dfd.jsonThe MDX loader/import path without the fix comes from the loader
resourcePath, and in this repro it has only one zero-width space:@site/_dogfooding/_docs tests/tests/zero-width-spaces/vulnerability-report<U+200B>/index.mdxThat produces the missing imported file:
site-dogfooding-docs-tests-tests-zero-width-spaces-vulnerability-report-index-mdx-9b6.jsonSo the mismatch is not just “same visible path, random hash.” The writer side is hashing the loaded docs source with two
U+200Bs, while the loader/import side is hashing a path with oneU+200B.With the dogfood repro added, disabling the resolution makes
yarn build:website:fastfail with the missing...9b6.jsonimport, and restoring it makes the same command pass.[-][BUG] Build fails when creating `docs/contribute/vulnerability-report/index.mdx`, but creating the file in another directory does not cause the error (very weird but reproducible)[/-][+]Zero-width space in mdx file path => build fails due to hash mismatch[/+]slorber commentedon May 22, 2026
This is likely a Rspack bundler issue.
My repro fails under Rspack, works if I turn off these 2 flags and build with Webpack:
We are going to upgrade to Rspack v2 asap, see if this is fixed, and if not we'll see how to send them a minimal repro.
danyalahmed1995 commentedon May 22, 2026
Confirmed locally with the exact #12052 repro. Default Rspack config fails with missing metadata imports for the zero-width-space paths. With only:and a clean build, the same repro passes.
So I agree this looks Rspack-specific rather than a docs metadata issue by itself.