{"record":{"id":"2f81105f1612efa2","repo":"vitejs/vite","slug":"failed-to-resolve-rolldownoptions-input-value-j","errorCode":null,"errorMessage":"failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.","messagePattern":"failed to resolve rolldownOptions\\.input value: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/optimizer/scan.ts","lineNumber":231,"sourceCode":"async function computeEntries(environment: ScanEnvironment) {\n  let entries: string[] = []\n\n  const explicitEntryPatterns = environment.config.optimizeDeps.entries\n  const input =\n    environment.config.input ?? environment.config.build.rolldownOptions.input\n\n  if (explicitEntryPatterns) {\n    entries = await globEntries(explicitEntryPatterns, environment)\n  } else if (input) {\n    const resolvePath = async (p: string) => {\n      const id = (\n        await environment.pluginContainer.resolveId(p, undefined, {\n          isEntry: true,\n          scan: true,\n        })\n      )?.id\n      if (id === undefined) {\n        throw new Error(\n          `failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`,\n        )\n      }\n      return id\n    }\n    if (typeof input === 'string') {\n      entries = [await resolvePath(input)]\n    } else if (Array.isArray(input)) {\n      entries = await Promise.all(input.map(resolvePath))\n    } else if (isObject(input)) {\n      entries = await Promise.all(Object.values(input).map(resolvePath))\n    } else {\n      throw new Error('invalid rolldownOptions.input value.')\n    }\n  } else {\n    entries = await globEntries('**/*.html', environment)\n  }\n","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/vitejs/vite/blob/b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab/packages/vite/src/node/optimizer/scan.ts#L213-L249","documentation":"Thrown during dependency scanning when `rolldownOptions.input` (or `build.rolldownOptions.input`, or `environment.config.input`) is set, and one of its values cannot be resolved to a file id by Vite's plugin container. `resolvePath` returns undefined and scan.ts:231 throws, naming the offending input value via JSON.stringify.","triggerScenarios":"Config sets `build.rollupOptions.input` / `optimizeDeps.entries` / environment `input` to a path or bare specifier that `pluginContainer.resolveId(p, undefined, { isEntry: true, scan: true })` cannot resolve. Triggered at server/build startup during `computeEntries`.","commonSituations":"Typo in the input path. Path relative to wrong root (input must be resolvable from project root, or absolute). Input points to a virtual module not handled by a plugin during scan. File was deleted or gitignored. Monorepo where the input lives in another package not symlinked. Conditional alias not active during scan.","solutions":["Verify the input path exists and is resolvable from the project root; print it with `console.log(path.resolve(input))`.","If it is a bare specifier or virtual id, add a plugin that resolves it during the scan (handle `isEntry: true, scan: true`).","Use `optimizeDeps.entries` with glob patterns for HTML/JS files instead of a single missing path.","Fix or remove aliases that are misconfigured for the scan phase.","Ensure the file is present on disk (un-ignore, restore from git, reinstall workspace)."],"exampleFix":"// before\nexport default defineConfig({\n  build: { rollupOptions: { input: './src/main.html' } }, // typo, real file is index.html\n})\n\n// after\nexport default defineConfig({\n  build: { rollupOptions: { input: './index.html' } },\n})","handlingStrategy":"validation","validationCode":"import fs from 'node:fs'\nimport path from 'node:path'\n\nfunction resolveInput(input: unknown, root: string): string[] {\n  const list: string[] = typeof input === 'string' ? [input]\n    : Array.isArray(input) ? input\n    : isObject(input) ? Object.values(input)\n    : []\n  for (const p of list) {\n    const abs = path.isAbsolute(p) ? p : path.resolve(root, p)\n    if (!fs.existsSync(abs)) throw new Error(`build.rolldownOptions.input '${p}' does not resolve to an existing file`)\n  }\n  return list\n}\n// call resolveInput(config.build.rolldownOptions.input, config.root) before server start","typeGuard":"function isInputValue(v: unknown): v is string | string[] | Record<string, string> {\n  return typeof v === 'string' || Array.isArray(v) || (typeof v === 'object' && v !== null && !Array.isArray(v))\n}","tryCatchPattern":"try {\n  await server.listen()\n} catch (e) {\n  if (e instanceof Error && /failed to resolve rolldownOptions\\.input value:/.test(e.message)) {\n    const val = e.message.match(/value: (.*)\\./)?.[1]\n    console.error(`Input ${val} could not be resolved; check path/alias and retry.`)\n  }\n  throw e\n}","preventionTips":["Keep build input paths relative to project root and verify they exist in a prebuild check.","Add aliases/plugins that resolve virtual inputs during the scan phase (isEntry:true, scan:true).","Prefer glob-based optimizeDeps.entries over fragile single-path inputs."],"tags":["optimizer","config","input","resolver","startup"],"backgroundTag":null,"analyzedSha":"b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab","analyzedAt":"2026-08-11T11:49:19.515Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}