{"record":{"id":"a6e970250bd05bf3","repo":"facebook/docusaurus","slug":"document-id-baseid-cannot-include-slash","errorCode":null,"errorMessage":"Document id \"${baseID}\" cannot include slash.","messagePattern":"Document id \"(.+?)\" cannot include slash\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/docs.ts","lineNumber":147,"sourceCode":"    vcs,\n  );\n\n  // E.g. api/plugins/myDoc -> myDoc; myDoc -> myDoc\n  const sourceFileNameWithoutExtension = path.basename(\n    source,\n    path.extname(source),\n  );\n\n  // E.g. api/plugins/myDoc -> api/plugins; myDoc -> .\n  const sourceDirName = path.dirname(source);\n\n  const {filename: unprefixedFileName, numberPrefix} = parseNumberPrefixes\n    ? options.numberPrefixParser(sourceFileNameWithoutExtension)\n    : {filename: sourceFileNameWithoutExtension, numberPrefix: undefined};\n\n  const baseID: string = frontMatter.id ?? unprefixedFileName;\n  if (baseID.includes('/')) {\n    throw new Error(`Document id \"${baseID}\" cannot include slash.`);\n  }\n\n  // For autogenerated sidebars, sidebar position can come from filename number\n  // prefix or front matter\n  const sidebarPosition: number | undefined =\n    frontMatter.sidebar_position ?? numberPrefix;\n\n  // TODO legacy retrocompatibility\n  // I think it's bad to affect the front matter id with the dirname?\n  function computeDirNameIdPrefix() {\n    if (sourceDirName === '.') {\n      return undefined;\n    }\n    // Eventually remove the number prefixes from intermediate directories\n    return parseNumberPrefixes\n      ? stripPathNumberPrefixes(sourceDirName, options.numberPrefixParser)\n      : sourceDirName;\n  }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/docs.ts#L129-L165","documentation":"Thrown by doProcessDocMetadata when the resolved base document id contains a '/'. baseID comes from frontMatter.id if present, else from the filename (after number-prefix stripping). The id must be a single path segment because the plugin itself joins the directory prefix with the baseID using '/'.","triggerScenarios":"Setting front matter `id: foo/bar`, or naming a doc file with a slash in its basename (rare). The check fires after frontMatter.id ?? unprefixedFileName.","commonSituations":"Manually setting an id with a slash to mirror a path, or migrating docs whose old ids contained slashes. Copy-paste of slug into the id field.","solutions":["Remove any '/' from the front matter `id` field.","Use the `slug` front matter if you want a custom URL path with slashes.","Rely on directory structure for hierarchical ids rather than embedding slashes in id."],"exampleFix":"---\n# before\nid: api/plugins\n---\n---\n# after\nid: plugins\nslug: /api/plugins\n---","handlingStrategy":"validation","validationCode":"const id = frontMatter.id ?? filename;\nif (id.includes('/')) throw new Error(`Doc id '${id}' must not contain '/' (use 'slug' for URL paths)`);","typeGuard":"const isSegmentId = (id: string): boolean => typeof id === 'string' && !id.includes('/');","tryCatchPattern":null,"preventionTips":["Keep front matter `id` a single path segment; use `slug` for URL paths.","Let the directory structure produce hierarchy instead of embedding slashes in ids."],"tags":["docs","frontmatter","id","validation"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}