{"record":{"id":"38a9dcdc42a761d7","repo":"facebook/docusaurus","slug":"no-searchpagepath-provided-in-themeconfig-algolia","errorCode":null,"errorMessage":"no searchPagePath provided in themeConfig.algolia","messagePattern":"no searchPagePath provided in themeConfig\\.algolia","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus-theme-search-algolia/src/opensearch.ts","lineNumber":87,"sourceCode":"    searchUrl: normalizeUrl([siteUrl, searchPagePath]),\n    faviconUrl: favicon ? normalizeUrl([siteUrl, favicon]) : null,\n  });\n}\n\nexport async function createOpenSearchFile({\n  context,\n}: {\n  context: LoadContext;\n}): Promise<void> {\n  const {\n    outDir,\n    siteConfig: {themeConfig},\n  } = context;\n  const {\n    algolia: {searchPagePath},\n  } = themeConfig as ThemeConfig;\n  if (!searchPagePath) {\n    throw new Error('no searchPagePath provided in themeConfig.algolia');\n  }\n  const fileContent = createOpenSearchFileContent({context, searchPagePath});\n  try {\n    await fs.writeFile(path.join(outDir, OPEN_SEARCH_FILENAME), fileContent);\n  } catch (err) {\n    throw new Error('Generating OpenSearch file failed.', {cause: err});\n  }\n}\n\nexport function createOpenSearchHeadTags({\n  context,\n}: {\n  context: LoadContext;\n}): HtmlTags {\n  const {\n    baseUrl,\n    siteConfig: {title},\n  } = context;","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-theme-search-algolia/src/opensearch.ts#L69-L105","documentation":"Thrown by createOpenSearchFile in theme-search-algolia when themeConfig.algolia.searchPagePath is falsy while building the OpenSearch description file (opensearch.xml). searchPagePath determines the search URL embedded in the OpenSearch descriptor; without it the file cannot be generated. Note the Joi schema allows null/false to disable search, so this guard fires only when OpenSearch generation is actually attempted.","triggerScenarios":"Setting themeConfig.algolia.searchPagePath to null or false (to disable the built-in search page) while createOpenSearchFile is still invoked (e.g. shouldCreateOpenSearchFile returned true, or a custom integration calls it directly).","commonSituations":"Disabling the standalone search page but the OpenSearch generation path still runs; misconfigured Algolia theme config; custom head-tag/postBuild hooks that call createOpenSearchFile unconditionally.","solutions":["Set searchPagePath to a real path (e.g. 'search', the default) if you want OpenSearch.","If you disabled search on purpose, ensure shouldCreateOpenSearchFile gates the call (it returns false when searchPagePath is falsy or router is hash).","Avoid calling createOpenSearchFile directly without first checking searchPagePath."],"exampleFix":"// before\nthemeConfig: { algolia: { ..., searchPagePath: null } }\n// after\nthemeConfig: { algolia: { ..., searchPagePath: 'search' } }","handlingStrategy":"validation","validationCode":"const { searchPagePath } = siteConfig.themeConfig.algolia ?? {};\nif (!searchPagePath) {\n  // do not call createOpenSearchFile; rely on shouldCreateOpenSearchFile\n}","typeGuard":"const hasSearchPagePath = (cfg: any): boolean =>\n  typeof cfg?.algolia?.searchPagePath === 'string' && cfg.algolia.searchPagePath.length > 0;","tryCatchPattern":null,"preventionTips":["Always gate createOpenSearchFile behind shouldCreateOpenSearchFile.","If disabling search, set searchPagePath:false and skip OpenSearch generation."],"tags":["algolia","opensearch","search","theme-config"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}