{"record":{"id":"ca53a7a258830cd0","repo":"microsoft/typescript-go","slug":"usepublishedplatformpackagesforvsix-requires-forre","errorCode":null,"errorMessage":"usePublishedPlatformPackagesForVsix requires forRelease","messagePattern":"usePublishedPlatformPackagesForVsix requires forRelease","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":2233,"sourceCode":"            return packageJson;\r\n        }\r\n    }\r\n\r\n    throw new Error(`Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.`);\r\n});\r\n\r\nfunction getPublishedTypeScriptVersion() {\r\n    const version = getPublishedTypeScriptPackageJson().version;\r\n    const expectedVersion = getVersion();\r\n    if (usePublishedPlatformPackagesForVsix && version !== expectedVersion) {\r\n        throw new Error(`usePublishedPlatformPackagesForVsix requires ${publishedTypeScriptAliasPackageName}'s installed version (${version}) to match release version ${expectedVersion}.`);\r\n    }\r\n    return version;\r\n}\r\n\r\nfunction checkPublishedPlatformPackagesForVsix() {\r\n    if (!options.forRelease) {\r\n        throw new Error(\"usePublishedPlatformPackagesForVsix requires forRelease\");\r\n    }\r\n    getPublishedTypeScriptVersion();\r\n}\r\n\r\nconst getPackageLock = memoize(() => JSON.parse(fs.readFileSync(path.join(__dirname, \"package-lock.json\"), \"utf8\")));\r\n\r\n/**\r\n * @param {string} npmPackageName\r\n */\r\nasync function getPublishedPlatformPackageLibDir(npmPackageName) {\r\n    let promise = publishedPlatformPackageLibDirs.get(npmPackageName);\r\n    if (!promise) {\r\n        promise = getPublishedPlatformPackageLibDirWorker(npmPackageName);\r\n        publishedPlatformPackageLibDirs.set(npmPackageName, promise);\r\n    }\r\n    return promise;\r\n}\r\n\r","sourceCodeStart":2215,"sourceCodeEnd":2251,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L2215-L2251","documentation":"checkPublishedPlatformPackagesForVsix (Herebyfile.mjs:2230) is the gate for building VSIXes from already-published platform packages: it demands hereby's --forRelease flag before even checking the published typescript version. Building VSIXes against published packages is a release-only operation because it stamps shipping artifacts, so local/non-release runs are rejected.","triggerScenarios":"usePublishedPlatformPackagesForVsix is true and a task that calls checkPublishedPlatformPackagesForVsix (runSignNativePreviewPackages early-return path, or runPackVsixExtensions) runs without --forRelease, e.g. `npx hereby native-preview:package-vsix` on a local build.","commonSituations":"A developer enables the published-packages VSIX path to test packaging but forgets the release flags; CI shares one script between local-mode and release-mode builds.","solutions":["Run the pipeline with release flags: `npx hereby native-preview:release --forRelease --setPrerelease=dev.N.M`","For local packaging tests, disable usePublishedPlatformPackagesForVsix so VSIXes are packed from locally built platform packages","Keep release-only task invocation in one CI script so the flags cannot be dropped"],"exampleFix":"# before\nnpx hereby native-preview:package-vsix  # with usePublishedPlatformPackagesForVsix enabled\n\n# after\nnpx hereby native-preview:release --forRelease --setPrerelease=dev.1.0","handlingStrategy":"validation","validationCode":"if (usePublishedPlatformPackagesForVsix && !args.includes(\"--forRelease\")) {\n  console.error(\"Published-package VSIX builds are release-only; add --forRelease\");\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable usePublishedPlatformPackagesForVsix for local packaging experiments","Gate release-only task invocations behind one checked-in script"],"tags":["build","release","vsix","hereby"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}