{"id":"eb9a67febf5ca06c","repo":"rollup/rollup","slug":"you-must-supply-options-input-to-rollup","errorCode":null,"errorMessage":"You must supply options.input to rollup","messagePattern":"You must supply options\\.input to rollup","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Graph.ts","lineNumber":154,"sourceCode":"\t\t}\n\n\t\treturn {\n\t\t\tmodules: this.modules.map(module => module.toJSON()),\n\t\t\tplugins: this.pluginCache\n\t\t};\n\t}\n\n\tgetModuleInfo = (moduleId: string): ModuleInfo | null => {\n\t\tconst foundModule = this.modulesById.get(moduleId);\n\t\tif (!foundModule) return null;\n\t\treturn foundModule.info;\n\t};\n\n\tprivate async generateModuleGraph(): Promise<void> {\n\t\t({ entryModules: this.entryModules, implicitEntryModules: this.implicitEntryModules } =\n\t\t\tawait this.moduleLoader.addEntryModules(normalizeEntryModules(this.options.input), true));\n\t\tif (this.entryModules.length === 0) {\n\t\t\tthrow new Error('You must supply options.input to rollup');\n\t\t}\n\t\tfor (const module of this.modulesById.values()) {\n\t\t\tmodule.cacheInfoGetters();\n\t\t\tif (module instanceof Module) {\n\t\t\t\tthis.modules.push(module);\n\t\t\t} else {\n\t\t\t\tthis.externalModules.push(module);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate includeStatements(): void {\n\t\tconst entryModules = [...this.entryModules, ...this.implicitEntryModules];\n\t\tfor (const module of entryModules) {\n\t\t\tmarkModuleAndImpureDependenciesAsExecuted(module);\n\t\t}\n\t\tif (this.options.treeshake) {\n\t\t\tlet treeshakingPass = 1;","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/rollup/rollup/blob/ddc4ffab628944e45dbb8d66d58aae818015440f/src/Graph.ts#L136-L172","documentation":"During `Graph.build`, Rollup resolves all configured entries through the module loader. If the resulting `entryModules` array is empty (no input resolved to an actual module), the build cannot proceed and throws. This happens after `addEntryPlugins`/input resolution, so even input plugins must produce at least one entry.","triggerScenarios":"Omitting `input`; passing `input: []`; an input glob/array that matched zero files; an input plugin that emits no entries; all entries being resolved as external or filtered out.","commonSituations":"Dynamic configs that produce empty input sets, misconfigured `@rollup/plugin-multi-entry`, typos in entry paths that get silently dropped, conditional configs that leave input unset.","solutions":["Set `input` to a file path, glob, array, or object that matches at least one existing file.","Verify your input plugin actually emits entries (check its `options` hook).","Ensure entries are not marked external or excluded by a filter.","Log the resolved input right before calling rollup() to catch empty sets."],"exampleFix":"// before\nawait rollup({ plugins: [...] });\n\n// after\nawait rollup({ input: 'src/main.js', plugins: [...] });","handlingStrategy":"validation","validationCode":"// Ensure input resolves to at least one entry before calling rollup().\nfunction hasEntries(input) {\n  if (!input) return false;\n  if (typeof input === 'string') return input.length > 0;\n  if (Array.isArray(input)) return input.length > 0;\n  if (typeof input === 'object') return Object.keys(input).length > 0;\n  return false;\n}\nif (!hasEntries(options.input)) {\n  throw new Error('options.input did not resolve to any entries');\n}","typeGuard":"// Narrow an unknown input config to a non-empty entry descriptor.\nfunction isNonEmptyInput(input) {\n  return typeof input === 'string' && input.length > 0\n    || (Array.isArray(input) && input.length > 0)\n    || (!!input && typeof input === 'object' && Object.keys(input).length > 0);\n}","tryCatchPattern":null,"preventionTips":["Always set options.input explicitly.","Verify glob results are non-empty before passing them as input.","Log the resolved input set in debug builds to catch silent drops.","Make sure input plugins actually emit entries via their options hook."],"tags":["config","input","api"],"analyzedSha":"ddc4ffab628944e45dbb8d66d58aae818015440f","analyzedAt":"2026-08-03T19:42:57.546Z","schemaVersion":2}