facebook/docusaurus · error · Error
DocSidebarNavbarItem: Sidebar with ID "${sidebarId}" doesn't
Error message
DocSidebarNavbarItem: Sidebar with ID "${sidebarId}" doesn't have anything to be linked to. What it means
Thrown by `DocSidebarNavbarItem` when the referenced sidebar has no `link` property (no first/default doc to point at). The navbar item tries to link to the sidebar's landing doc; if the sidebar definition exposes no `link`, there is nowhere for the navbar entry to navigate, so the render aborts.
Source
Thrown at packages/docusaurus-theme-classic/src/theme/NavbarItem/DocSidebarNavbarItem.tsx:25
import React, {type ReactNode} from 'react';
import {
useActiveDocContext,
useLayoutDocsSidebar,
} from '@docusaurus/plugin-content-docs/client';
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
import type {Props} from '@theme/NavbarItem/DocSidebarNavbarItem';
export default function DocSidebarNavbarItem({
sidebarId,
label,
docsPluginId,
...props
}: Props): ReactNode {
const {activeDoc} = useActiveDocContext(docsPluginId);
const sidebarLink = useLayoutDocsSidebar(sidebarId, docsPluginId).link;
if (!sidebarLink) {
throw new Error(
`DocSidebarNavbarItem: Sidebar with ID "${sidebarId}" doesn't have anything to be linked to.`,
);
}
return (
<DefaultNavbarItem
exact
{...props}
isActive={() => activeDoc?.sidebar === sidebarId}
label={label ?? sidebarLink.label}
to={sidebarLink.path}
/>
);
}
View on GitHub (pinned to 3f483e80e3)
Solutions
- Verify the `sidebarId` matches a key in your sidebars config and that the sidebar has at least one doc that resolves to a `link`.
- Set a sidebar index (e.g. via `docId` on an autogenerated category, or a top-level doc) so the sidebar has a landing route.
- Confirm `docsPluginId` (for multi-instance docs) points at the plugin instance that owns the sidebar.
- If the sidebar intentionally has no link, switch the navbar item to `type: 'doc'` pointing at a specific doc instead.
Example fix
// before
navbar: [
{type: 'docSidebar', sidebarId: 'emptySidebar'}
]
// after — give the sidebar a landing doc, then reference it
sidebars: {mySidebar: [{type: 'autogenerated', dirName: '.'}]}
// (ensure _category_.json or docs intro resolves to a `link`)
navbar: [
{type: 'docSidebar', sidebarId: 'mySidebar'}
] Defensive patterns
Strategy: validation
Validate before calling
import {useLayoutDocsSidebar} from '@docusaurus/ThemeCommon';
const sidebar = useLayoutDocsSidebar(sidebarId, docsPluginId);
if (!sidebar?.link) {
// render a fallback navbar item or skip, do not mount DocSidebarNavbarItem
return null;
} Type guard
function sidebarHasLink(s: {link?: unknown} | null): s is {link: {path: string; label: string}} {
return !!s?.link && typeof s.link.path === 'string';
} Prevention
- Verify each `sidebarId` in your navbar has a resolvable landing doc.
- Run `docusaurus build` locally — a missing link fails at render time.
- Keep `docsPluginId` consistent with the docs instance owning the sidebar.
When it happens
Trigger: Configuring a navbar item `type: 'docSidebar', sidebarId: 'someSidebar'` where `someSidebar` has no `link` resolved (e.g. it is an empty sidebar, only contains autogenerated content with no index, or the sidebar ID is for a versioned docs instance without a default doc).
Common situations: Mis-typed `sidebarId` in `docusaurus.config.js`; a sidebar that was emptied or renamed; using a sidebar from a docs plugin instance that has no default route; referencing a sidebar ID that exists only in a different `docsPluginId` than the one declared.
Related errors
- No docs version exist for name '${name}', please verify your
- Docusaurus bug, no locale config found for locale=${locale}
- No NavbarItem component found for type "${type}".
- Can't find any sidebar with id "${sidebarId}" in version${ve
- Couldn't find any doc with id "${docId}" in version${version
AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12).
Data as JSON: /api/errors/5b3e93bcf7331b70.
Report an issue: GitHub.