{"record":{"id":"e6561b9fd8774414","repo":"microsoft/typescript-go","slug":"this-task-should-not-be-run-in-release-builds","errorCode":null,"errorMessage":"This task should not be run in release builds.","messagePattern":"This task should not be run in release builds\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":2413,"sourceCode":"    run: async () => {\r\n        if (!options.forRelease || !options.setPrerelease && (!nativePreviewReleaseVersion || produceAnyVsix)) {\r\n            throw new Error(\"native-preview:release requires --forRelease and --setPrerelease flags, unless nativePreviewReleaseVersion is hardcoded and VSIX production is disabled. Example: npx hereby native-preview:release --forRelease --setPrerelease=dev.1.0\");\r\n        }\r\n        await runBuildNativePreviewPackages();\r\n        await runSignNativePreviewPackages();\r\n        await runPackNativePreviewPackages();\r\n        await runPackVsixExtensions();\r\n        await runSignVsixExtensions();\r\n        await runCleanSignTempDirectory();\r\n    },\r\n});\r\n\r\nexport const nativePreview = task({\r\n    name: \"native-preview\",\r\n    hiddenFromTaskList: true,\r\n    dependencies: options.forRelease ? undefined : [packNativePreviewPackages, packVsixExtensions],\r\n    run: options.forRelease ? async () => {\r\n        throw new Error(\"This task should not be run in release builds.\");\r\n    } : undefined,\r\n});\r\n\r\nexport const allChecks = task({\r\n    name: \"all-checks\",\r\n    description: \"Runs all checks for the Go code (fourslash, lint, tests, etc.)\",\r\n    run: async () => {\r\n        await $`npm run convertfourslash`;\r\n        await runTests();\r\n        await $`npm run updatefailing`;\r\n        await runFormat();\r\n        await runLint();\r\n        await runTests();\r\n    },\r\n});\r\n","sourceCodeStart":2395,"sourceCodeEnd":2429,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L2395-L2429","documentation":"The `native-preview` task is the local/dev aggregate: its dependencies and run function are chosen from `options.forRelease`, and when forRelease is set its run() simply throws — in release mode the correct entry point is `native-preview:release`, which orchestrates build, sign, pack, VSIX, and cleanup with the proper flags. This prevents a release-mode invocation of the dev task from producing unsigned, mis-versioned artifacts.","triggerScenarios":"Running `npx hereby native-preview --forRelease` (with or without --setPrerelease): the dev task detects release mode and refuses.","commonSituations":"Muscle-memory reuse of the local task name in a release script; scripts that append --forRelease to whichever native-preview task they find; stale docs referencing the old task name.","solutions":["In release mode, use `npx hereby native-preview:release --forRelease --setPrerelease=dev.N.M` instead","Keep using plain `npx hereby native-preview` only for local, non-release builds","Update scripts/docs so the task name is chosen based on release mode"],"exampleFix":"# before\nnpx hereby native-preview --forRelease --setPrerelease=dev.1.0\n\n# after\nnpx hereby native-preview:release --forRelease --setPrerelease=dev.1.0","handlingStrategy":"validation","validationCode":"const task = forRelease ? \"native-preview:release\" : \"native-preview\";\nconst flags = forRelease ? [\"--forRelease\", `--setPrerelease=${prerelease}`] : [];\n// spawn: npx hereby ${task} ${flags.join(\" \")}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose the hereby task name from release mode in scripts — never a fixed name","Remember: `native-preview` is local-only; `native-preview:release` is the release entry point"],"tags":["release","hereby","build","task-selection"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}