You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI: the workspace root re-invokes nx, racing docs-site:build against itself #693
docs-site:build fails on every CI run on main, so the Lint, typecheck & build job is red regardless of what a PR changes. It is the only failing task in nx run-many -t build — the other 8 projects, including @scaffald/ui-docs, build fine in the same run.
Symptom
Both webpack passes succeed, then SSG cannot find its own server bundle:
[webpackbar] ✔ Server: Compiled successfully in 4.74s
[webpackbar] ✔ Client: Compiled successfully in 9.92s
[ERROR] Error: Unable to build website for locale en.
[cause]: [Error: ENOENT: no such file or directory,
open 'packages/sdk/docs-site/build/__server/server.bundle.js']
Reproduces identically in CI (run 33556024344, Node 22) and locally (Node 26), so it is not environment-specific.
future: {v4: true,// Improve compatibility with the upcoming Docusaurus v4},
Flipping that single flag to false and re-running pnpm exec docusaurus build in the same tree, with nothing else changed, gives [SUCCESS] Generated static files in "build". That is the whole difference: packages/ui/docs-site has no future block and builds cleanly, and its only other config divergence is three extra plugins (plugin-ideal-image, theme-mermaid, docusaurus-plugin-sass) which are not implicated.
Two candidate fixes
Upgrade Docusaurus 3.9.2 → 3.10.2. The build itself prints an update notice. If this is a 3.9.x SSG bug under the v4 flag, upgrading keeps the forward-compatibility intent. Verify the flag still works after upgrading.
Set v4: false for now. Cheaper, but gives up the v4 readiness the flag was added for, so prefer 1 unless it does not fix it.
Note on where the fix lands
packages/sdk is a git submodule (Scaffald/sdk). This needs a PR there plus a pointer bump here — it cannot be fixed in this repo alone.
Acceptance
pnpm exec nx run-many -t build succeeds with docs-site:build included
Lint, typecheck & build is green on main
The forward-compatibility intent of future.v4 is either preserved or the reason for dropping it is recorded in the config
Found while batching dependabot #670/#671/#672 into #692 — it is pre-existing and unrelated to those bumps.
Correction worth recording: the Lint, typecheck & build job reports two failed tasks, not one, and it looked like two problems. It is one.
Failed tasks:
- docs-site:build
- scaffald:build
scaffald is the workspace root, and it is a real nx project (nx show projects lists it alongside the 14 packages). Its build target runs the root package.json script:
So CI's nx run-many -t build picks up scaffald, whose build shells out to a secondnx run-many -t build. The inner run excludes scaffald (breaking the recursion) and @scaffald/ui-docs — but not docs-site. It builds docs-site, that fails, the inner run exits non-zero, and scaffald:build fails with it. That is why the log shows two "Running target build for N projects failed" summaries, one for 10 projects and one for 8.
Two consequences:
Fixing future.v4 clears both tasks. There is no separate scaffald:build bug to chase.
Every project in the inner run gets built twice per CI run — once by the outer run, once by the inner one. Whether the root should have a build target that re-invokes nx at all is a separate question, but it is doubling build time on every run and it turns any single project's failure into two red tasks. Worth splitting out if someone wants it.
Verified on run 33560765459 (PR #692) and on main at 41c5448 — identical failed-task sets, so neither is caused by the dependency batch.
The root cause in the description is wrong.future.v4 is not the bug. #697 fixes this a different way, and the title of this issue is misleading — worth reading before acting on it.
The v4 evidence was real but the conclusion did not follow. Flipping v4: false does make the failure go away, so it looked causal. What v4 actually does is route SSG through build/__server/server.bundle.js. Turning it off means nothing reads that path, which hides the failure rather than fixing it.
Three things settled it:
docs-site builds cleanly on its own with v4: true left enabled — on a fully clean tree (rm -rf node_modules + pnpm install --frozen-lockfile). If the config were wrong, this would fail. It does not.
One CI run contains both outcomes for the same task, with nx naming it:
##[group]✅ > nx run docs-site:build [SUCCESS] Generated static files
NX Nx detected a flaky task
##[group]❌ > nx run docs-site:build ENOENT … server.bundle.js
A deterministic config error cannot both succeed and fail in one run.
Locally it passes or fails depending on cache state. Cold cache in one worktree: fails. Warm: passes, because the inner nx run replays cached output instead of rebuilding.
The actual cause is the recursion described in my earlier comment, which I had noted as a consequence and which turns out to be the cause. project.json neutralises lint, test and typecheck with echo no-ops so the workspace root does not recurse — but build was never given the same treatment, so nx infers it from the root package.json script, which re-invokes nx run-many -t build. Two nx runs then build docs-site into the same directory concurrently, and whichever is mid-SSG when the other clears build/ dies on the artifact it was about to read.
#697 adds the missing no-op. The nested run disappears, docs-site:build runs once instead of twice, all 10 projects still build, and future.v4: true stays exactly as it was.
Also worth noting for anyone tempted by the Docusaurus 3.9.2 → 3.10.2 upgrade suggested in the description: I tried it, and it breaks differently. This repo uses node-linker=hoisted, and 3.10.2's tree hoists [email protected] (ESM-only) into packages/sdk/node_modules/, where it shadows the execa@^5.1.1 that @docusaurus/core/bin/beforeCli.mjs default-imports:
SyntaxError: The requested module 'execa' does not provide an export named 'default'
That upgrade is worth doing eventually, but it needs its own issue and is unrelated to this one.
changed the title [-]CI: docs-site:build has been red on main since Docusaurus future.v4 was enabled[/-][+]CI: the workspace root re-invokes nx, racing docs-site:build against itself[/+]on Sep 2, 2026
Activity
thinkclay commentedon Sep 1, 2026
Correction worth recording: the Lint, typecheck & build job reports two failed tasks, not one, and it looked like two problems. It is one.
scaffaldis the workspace root, and it is a real nx project (nx show projectslists it alongside the 14 packages). Itsbuildtarget runs the rootpackage.jsonscript:So CI's
nx run-many -t buildpicks upscaffald, whose build shells out to a secondnx run-many -t build. The inner run excludesscaffald(breaking the recursion) and@scaffald/ui-docs— but notdocs-site. It buildsdocs-site, that fails, the inner run exits non-zero, andscaffald:buildfails with it. That is why the log shows two "Running target build for N projects failed" summaries, one for 10 projects and one for 8.Two consequences:
future.v4clears both tasks. There is no separatescaffald:buildbug to chase.buildtarget that re-invokes nx at all is a separate question, but it is doubling build time on every run and it turns any single project's failure into two red tasks. Worth splitting out if someone wants it.Verified on run 33560765459 (PR #692) and on
mainat 41c5448 — identical failed-task sets, so neither is caused by the dependency batch.chore(deps): batch dependabot #670, #671, #672; fix the Monorepo inte…
thinkclay commentedon Sep 2, 2026
The root cause in the description is wrong.
future.v4is not the bug. #697 fixes this a different way, and the title of this issue is misleading — worth reading before acting on it.The v4 evidence was real but the conclusion did not follow. Flipping
v4: falsedoes make the failure go away, so it looked causal. What v4 actually does is route SSG throughbuild/__server/server.bundle.js. Turning it off means nothing reads that path, which hides the failure rather than fixing it.Three things settled it:
docs-sitebuilds cleanly on its own withv4: trueleft enabled — on a fully clean tree (rm -rf node_modules+pnpm install --frozen-lockfile). If the config were wrong, this would fail. It does not.One CI run contains both outcomes for the same task, with nx naming it:
A deterministic config error cannot both succeed and fail in one run.
Locally it passes or fails depending on cache state. Cold cache in one worktree: fails. Warm: passes, because the inner nx run replays cached output instead of rebuilding.
The actual cause is the recursion described in my earlier comment, which I had noted as a consequence and which turns out to be the cause.
project.jsonneutraliseslint,testandtypecheckwith echo no-ops so the workspace root does not recurse — butbuildwas never given the same treatment, so nx infers it from the rootpackage.jsonscript, which re-invokesnx run-many -t build. Two nx runs then builddocs-siteinto the same directory concurrently, and whichever is mid-SSG when the other clearsbuild/dies on the artifact it was about to read.#697 adds the missing no-op. The nested run disappears,
docs-site:buildruns once instead of twice, all 10 projects still build, andfuture.v4: truestays exactly as it was.Also worth noting for anyone tempted by the Docusaurus 3.9.2 → 3.10.2 upgrade suggested in the description: I tried it, and it breaks differently. This repo uses
node-linker=hoisted, and 3.10.2's tree hoists[email protected](ESM-only) intopackages/sdk/node_modules/, where it shadows theexeca@^5.1.1that@docusaurus/core/bin/beforeCli.mjsdefault-imports:That upgrade is worth doing eventually, but it needs its own issue and is unrelated to this one.
[-]CI: docs-site:build has been red on main since Docusaurus future.v4 was enabled[/-][+]CI: the workspace root re-invokes nx, racing docs-site:build against itself[/+]fix(nx): stop the root project re-invoking nx, which raced docs-site …