- Build fails with “Unable to build website for locale en”
- “OpenAPI docs plugin ID must be specified when more than one plugin instance exists”
pnpm gen-api-docs -p <plugin-id>does not create subfolders- API docs generated but routes do not appear in the sidebar
- “Cannot find module …/sidebar.ts”
- Sidebar looks duplicated or shows raw route segments
- Error:
useDocsSidebar/DocsSidebarProviderwhen opening a sidebar item - Broken MDX or images
- Port already in use (
Something is already running on port 3000) - Still stuck
Troubleshooting
Quick fixes for problems you may hit while working on this documentation site (Docusaurus 3, OpenAPI plugin, custom sidebars).
Build fails with “Unable to build website for locale en”
- Scroll to the first error in the terminal output. Docusaurus often reports a cause (invalid doc id, broken link, MDX error).
- Typical causes in this repo:
- Invalid doc id in a generated
sidebar.tsunderdocs/openapi/...— the id must match a real document the classic docs plugin knows about. - Broken links — internal links must match the route Docusaurus generates (including path segments for nested OpenAPI folders).
- MDX compilation errors — see Broken MDX or images.
- Invalid doc id in a generated
After fixing, run:
bashpnpm build
“OpenAPI docs plugin ID must be specified when more than one plugin instance exists”
This project registers several docusaurus-plugin-openapi-docs instances in docusaurus.config.ts. You must pass the plugin id and the config key for the spec you want to generate.
Example pattern (adjust id and key to match your entry in the config):
bash# Worker (~3200)pnpm gen-api-docs:notification-worker# Orchestrator (~3210)pnpm gen-api-docs:notification-orchestrator
Equivalente explícito:
bashpnpm docusaurus gen-api-docs notification-service notificationServicepnpm docusaurus gen-api-docs orchestrator-message-service orchestratorMessageService
List the plugin blocks in docusaurus.config.ts and use each block’s id and the key inside config: { ... }.
For all specs (if your setup supports it):
bashpnpm gen-api-docs
pnpm gen-api-docs -p <plugin-id> does not create subfolders
When you generate docs for a single OpenAPI plugin instance, for example:
bashpnpm gen-api-docs -p <plugin-id>
(replace <plugin-id> with the unique id from the corresponding block in docusaurus.config.ts)
the command does not create intermediate subfolders under outputDir. If your layout relies on nested directories (for example tag-based groups under docs/openapi/<service>/…), create those folders yourself before running pnpm gen-api-docs -p …. Otherwise generation may fail or write files where the rest of the site does not expect them.
API docs generated but routes do not appear in the sidebar
- Confirm files were written under the expected
outputDir(see the plugin config indocusaurus.config.ts). - Open the generated
sidebar.tsin that folder (or subfolders when usinggroupPathsBy: 'tag'). - Register those sidebar files in the root
sidebars.tsunderapiSidebar, as described in Add Items to Sidebar. - Restart the dev server after adding new files: stop
pnpm startand start again so Node canrequire()new modules.
“Cannot find module …/sidebar.ts”
The OpenAPI plugin or root sidebars.ts references a path that does not exist yet.
- Run the appropriate
gen-api-docscommand so the file is created, or - Remove or fix the
require(...)path insidebars.tsuntil the file exists.
Then restart pnpm start.
Sidebar looks duplicated or shows raw route segments
Usually the generated sidebar.ts mixes top-level doc items with categories that repeat the same labels. Prefer only categories (or a single consistent structure) inside each sidebar.ts, and ensure doc ids match the generated MDX frontmatter. Re-run pnpm build to validate.
Error: useDocsSidebar / DocsSidebarProvider when opening a sidebar item
Custom OpenAPI tag pages (*.tag.mdx) must not call React hooks (for example useCurrentSidebarCategory) inside a fenced mdx-code-block section. That runs the code outside the normal doc layout context.
Render DocCardList and hooks as normal MDX/JSX in the file body, not inside mdx-code-block.
Broken MDX or images
- Images: use paths relative to the MDX file, or place assets under
static/and reference them with a leading/. - Trailing underscores or broken filenames in image URLs often fail resolution — rename the file and update the markdown to match exactly.
Port already in use (Something is already running on port 3000)
Either stop the other process or accept another port when the CLI prompts you. The site URL will be shown in the terminal (for example http://localhost:3002/).
Still stuck
- Run
pnpm buildand capture the full first error block. - Check
docusaurus.config.tsfor the pluginidandoutputDiryou are working with. - Compare doc ids in
sidebars.tswith theidin the frontmatter of the target.mdx/.mdfiles.