fix(docs): [STOPGAP] wrap two bare <token> placeholders so MDX can parse codes.mdx - #281
fix(docs): [STOPGAP] wrap two bare <token> placeholders so MDX can parse codes.mdx#281r-marques wants to merge 1 commit into
Conversation
`mintlify broken-links` could not check a single page in this repo. It aborted
while parsing `development-guide/api-errors/codes.mdx`, where two table cells
contain a bare `<token>` placeholder that MDX reads as an unclosed JSX element:
erro Syntax error - Unable to parse development-guide/api-errors/codes.mdx -
109:133-109:264: Expected a closing tag for `<token>` (109:165-109:172)
Wraps both in backticks, matching lines 119 and 122 which already use that form
and parse fine. Two lines changed; no wording altered beyond dropping the now-
redundant straight quotes on line 310.
With this, `mintlify broken-links` runs to completion for the first time and
reports **no broken links found** across the whole site.
Closes nevermined-io/nvm-monorepo#2795
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
eruizgar91
left a comment
There was a problem hiding this comment.
Reviewed the two-line MDX fix and traced where the file it patches comes from.
The diagnosis is right and the content of the fix is right — but codes.mdx is generated output, so this is applied in the wrong repository and the next catalogue sync reverts it. One HIGH inline.
Everything else checked out: lines 109 and 310 really are the only remaining bare placeholders (the other two occurrences already carry backticks), and the <a id="…"> anchors throughout are legitimate JSX, not the same bug.
Verdict: REQUEST_CHANGES — not on the change, on the repo it is applied in.
| |---|---|---|---|---|---| | ||
| | <a id="bck-auth-0001"></a>`BCK.AUTH.0001` | 500 | internal | — | Error registering API Key | Inspect the underlying error in the logs by correlation id. API-key registration failed with an unexpected server-side error (usually a DB-layer fault). | | ||
| | <a id="bck-auth-0002"></a>`BCK.AUTH.0002` | 401 | auth | — | Authentication required: credentials are missing, expired or invalid | Send an Authorization: Bearer <token> header or a valid Nevermined API key. Anonymous access is not permitted on this endpoint. | | ||
| | <a id="bck-auth-0002"></a>`BCK.AUTH.0002` | 401 | auth | — | Authentication required: credentials are missing, expired or invalid | Send an `Authorization: Bearer <token>` header or a valid Nevermined API key. Anonymous access is not permitted on this endpoint. | |
There was a problem hiding this comment.
HIGH — codes.mdx is generated, not authored. scripts/generate-errors-doc.ts --target=docs-site in nvm-monorepo writes this entire file into this repo, and both hints patched here are verbatim from its source:
libs/helpers/src/lib/output/api-errors.ts:3308—hint: 'Send an Authorization: Bearer <token> header or a valid Nevermined API key. …'libs/helpers/src/lib/output/api-errors.ts:3731—hint: '… Send "Authorization: Bearer <token>" matching the configured scrape token.'
So the next sync reverts both lines and mintlify broken-links breaks again in exactly the same way. That sync is live practice, not hypothetical — 97a4caf7, "docs: sync API errors catalogue (nvm-monorepo@3e70243)" (#276), landed two days ago on 2026-08-05.
The trap is genuinely invisible from inside this repo: the generator emits its "Do not edit by hand — regenerate via pnpm docs:errors:generate" banner only on the in-repo target; the isMdx branch drops it. Nothing in this file says it is generated.
Fix it in api-errors.ts instead — backticks around both placeholders, dropping the now-redundant straight quotes on BCK.METRICS.0001 exactly as you did here — then run pnpm docs:errors:generate:site and let the sync produce this diff. If you want the parser unblocked before that lands, keep this PR but say in the description that it is a stopgap pending the source change, so the next sync does not silently undo it and cost someone the same debugging session twice.
There was a problem hiding this comment.
Confirmed — every part of this checked out, and thank you for tracing it. I verified before acting rather than taking it on faith:
scripts/generate-errors-doc.ts+docs:errors:generate:siteexist as described.- Both hints are at exactly
api-errors.ts:3308and:3731. - The sync is live practice — five
sync API errors cataloguecommits, including97a4caf(docs: sync API errors catalogue (nvm-monorepo@3e70243) #276) and a newer4e6452e. This would have been reverted. - The banner really is
in-repo-only: line 95 is inside theelse, and theisMdxbranch (77–90) has nothing.
Fixed at source in nevermined-io/nvm-monorepo#2805, which does three things:
- The two hints, backticked exactly as here.
- Emits the
AUTO-GENERATED — DO NOT EDITbanner on the docs-site target too. Your point that the trap is invisible from inside this repo is the root cause, not a side note — leaving it means the next person repeats the same debugging session. It's an MDX comment, so it warns whoever opens the file without appearing on the rendered page. - A guard in
api-errors-category.spec.tsasserting nomessage/hintcarries an un-backticked angle-bracket placeholder. Mutation-tested: reverting (1) fails it namingBCK.AUTH.0002.hintandBCK.METRICS.0001.hint. Across all 511 codes it finds nothing else — which independently confirms your conclusion that lines 109 and 310 were the only two left.
Verified end to end: generated the docs-site output, dropped it into this repo, mintlify broken-links → no broken links found, the first time it has run to completion.
Taking your suggested option on this PR: keeping it as an explicitly-labelled stopgap so the parser is unblocked before the source change and the sync land, with the description updated to say so. If you'd rather just close it and wait for the bot's PR, say the word — no attachment to it.
One thing I found while there: docs/api/nvm-errors.md in nvm-monorepo is independently stale — 510 codes vs the catalogue's 511, since 00dc50ac0 landed a BCK.OAUTH code without a regeneration. Left alone in #2805 to keep it reviewable; the sync bot's PR will absorb it.
mintlify broken-linkscould not check a single page in this repo. It aborted while parsingdevelopment-guide/api-errors/codes.mdx:Two table cells contain a bare
<token>placeholder, which MDX parses as a JSX element and then fails to close:Send an Authorization: Bearer <token> header …Send "Authorization: Bearer <token>" matching …The fix
Wrap both in backticks — exactly what lines 119 and 122 already do with the same placeholder, which is why those two parse fine:
Two lines. No wording changed beyond dropping the now-redundant straight quotes on line 310.
Verification
mintlify broken-linksnow runs to completion for the first time and reportssuccess no broken links found. That is also the proof these were the only blocker — the parser previously stopped at the first bad file, so reaching "success" means every remaining page parses.Why it went unnoticed
The check was never failing, it was not running: it died at parse time before link checking, so it never reported a broken link either way — the "green because nothing ran" shape.
Two follow-ups now handled in #2805: the generator emits its
DO NOT EDITbanner only on thein-repotarget, so nothing in this file says it is generated (which is exactly how this PR came to be written against the wrong repo); and a unit guard now pins that no errormessage/hintcarries an un-backticked placeholder.🤖 Generated with Claude Code