{"id":"c11f4597b49b8b60","repo":"vitejs/vite","slug":"html-proxy-index-in-id-not-found","errorCode":null,"errorMessage":"HTML proxy index in \"${id}\" not found","messagePattern":"HTML proxy index in \"(.+?)\" not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/plugins/css.ts","lineNumber":569,"sourceCode":"          include: CSS_LANGS_RE,\n          exclude: [commonjsProxyRE, SPECIAL_QUERY_RE],\n        },\n      },\n      async handler(css, id) {\n        css = stripBomTag(css)\n\n        // cache css compile result to map\n        // and then use the cache replace inline-style-flag\n        // when `generateBundle` in vite:build-html plugin and devHtmlHook\n        const inlineCSS = inlineCSSRE.test(id)\n        const isHTMLProxy = htmlProxyRE.test(id)\n        if (inlineCSS && isHTMLProxy) {\n          if (styleAttrRE.test(id)) {\n            css = css.replace(/\"/g, '&quot;')\n          }\n          const index = htmlProxyIndexRE.exec(id)?.[1]\n          if (index == null) {\n            throw new Error(`HTML proxy index in \"${id}\" not found`)\n          }\n          addToHTMLProxyTransformResult(\n            `${getHash(cleanUrl(id))}_${Number.parseInt(index)}`,\n            css,\n          )\n          return {\n            code: `export default ''`,\n            map: { mappings: '' },\n          }\n        }\n\n        const inlined = inlineRE.test(id)\n        const modules = cssModulesCache.get(config)!.get(id)\n\n        // #6984, #7552\n        // `foo.module.css` => modulesCode\n        // `foo.module.css?inline` => cssContent\n        const modulesCode =","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/plugins/css.ts#L551-L587","documentation":"Thrown in the CSS `transform` hook when processing an inline-CSS request that is also an HTML proxy module, but the proxy index could not be extracted from the id. The id normally contains an `?html-proxy&index=N` segment parsed by `htmlProxyIndexRE`; if that regex does not match, Vite cannot correlate the CSS back to its originating `<style>` block.","triggerScenarios":"A request id matches both `inlineCSSRE` and `htmlProxyRE` but `htmlProxyIndexRE.exec(id)` returns null (no `&index=` portion present). This usually indicates a malformed proxy id generated internally or an unexpected manual request.","commonSituations":"This is an internal invariant violation. Most often seen with custom plugins that manipulate HTML proxy ids, with stale HMR module graphs after upgrading Vite, or with hand-crafted requests to the dev server.","solutions":["Clear Vite's cache (`node_modules/.vite`) and restart the dev server.","Disable custom plugins that rewrite or generate HTML proxy ids to isolate the cause.","Upgrade Vite to the latest patch — proxy id formats changed across versions and stale tooling can generate mismatched ids.","Report the full `id` from the error message if it recurs, as it indicates a Vite-internal bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await transform();\n} catch (e) {\n  if (/HTML proxy index .* not found/.test(e.message)) {\n    // restart dev server / clear .vite cache\n    console.warn('HTML proxy index missing — clearing cache and restarting');\n  }\n  throw e;\n}","preventionTips":["Avoid custom plugins that rewrite HTML proxy ids.","Restart Vite after upgrading to refresh the proxy id format.","Clear `node_modules/.vite` when HMR behaves inconsistently."],"tags":["css","html-proxy","internal","hmr"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}