{"record":{"id":"bedf420675e346f8","repo":"microsoft/TypeScript","slug":"lkg-cannot-be-created-when-bundle-false","errorCode":null,"errorMessage":"LKG cannot be created when --bundle=false","messagePattern":"LKG cannot be created when --bundle=false","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":903,"sourceCode":"//                 path here seems like a bad idea.\r\nexport const updateSublime = task({\r\n    name: \"update-sublime\",\r\n    description: \"Updates the sublime plugin's tsserver\",\r\n    dependencies: [tsserver],\r\n    run: async () => {\r\n        for (const file of [\"built/local/tsserver.js\", \"built/local/tsserver.js.map\"]) {\r\n            await fs.promises.copyFile(file, path.resolve(\"../TypeScript-Sublime-Plugin/tsserver/\", path.basename(file)));\r\n        }\r\n    },\r\n});\r\n\r\nexport const produceLKG = task({\r\n    name: \"LKG\",\r\n    description: \"Makes a new LKG out of the built js files\",\r\n    dependencies: [local],\r\n    run: async () => {\r\n        if (!cmdLineOptions.bundle) {\r\n            throw new Error(\"LKG cannot be created when --bundle=false\");\r\n        }\r\n\r\n        const expectedFiles = [\r\n            \"built/local/tsc.js\",\r\n            \"built/local/_tsc.js\",\r\n            \"built/local/tsserver.js\",\r\n            \"built/local/_tsserver.js\",\r\n            \"built/local/tsserverlibrary.js\",\r\n            \"built/local/tsserverlibrary.d.ts\",\r\n            \"built/local/typescript.js\",\r\n            \"built/local/typescript.d.ts\",\r\n            \"built/local/typingsInstaller.js\",\r\n            \"built/local/_typingsInstaller.js\",\r\n            \"built/local/watchGuard.js\",\r\n        ].concat(libs().map(lib => lib.target));\r\n        const missingFiles = expectedFiles\r\n            .concat(localizationTargets)\r\n            .filter(f => !fs.existsSync(f));\r","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/Herebyfile.mjs#L885-L921","documentation":"The `LKG` (Last Known Good) hereby task copies freshly built JS into lib/ so the compiler can self-host. It is gated on the `--bundle` CLI option because the LKG must contain the bundled entrypoints (_tsc.js, _tsserver.js, etc.); without bundling the LKG would be incomplete and break the self-host build.","triggerScenarios":"Running `hereby LKG` (or the produce-LKG task) without passing `--bundle` on the hereby command line, so `cmdLineOptions.bundle` is false.","commonSituations":"Skipping the bundle flag for a faster local cycle; CI that invokes the LKG task directly without forwarding --bundle.","solutions":["Run `hereby LKG --bundle` (pass --bundle explicitly).","Ensure `hereby local` completed successfully first, then re-run with --bundle.","If you intentionally never bundle, do not run the LKG task — it is not meaningful without bundling."],"exampleFix":"// before\n$ hereby LKG\n\n// after\n$ hereby LKG --bundle","handlingStrategy":"validation","validationCode":"// Before running LKG, confirm the bundle flag is set.\nif (!cmdLineOptions.bundle) {\n  throw new Error(\"Refusing to run produceLKG without --bundle; pass --bundle on the hereby CLI.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always invoke `hereby LKG --bundle`.","Wire CI to fail fast if the LKG task is called without --bundle.","Document that LKG depends on a bundled `local` build."],"tags":["build","lkg","bundle","hereby"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}