{"record":{"id":"b28e6dba1ab00ba9","repo":"microsoft/monaco-editor","slug":"missing-prerelease-version-in-process-env","errorCode":null,"errorMessage":"Missing PRERELEASE_VERSION in process.env","messagePattern":"Missing PRERELEASE_VERSION in process\\.env","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ci/env.ts","lineNumber":9,"sourceCode":"interface Env {\n\tVSCODE_REF: string;\n\tPRERELEASE_VERSION: string;\n}\n\nexport function getNightlyEnv(): Env {\n\tconst env: Env = process.env as any;\n\tif (!env.PRERELEASE_VERSION) {\n\t\tthrow new Error(`Missing PRERELEASE_VERSION in process.env`);\n\t}\n\tif (!env.VSCODE_REF) {\n\t\tthrow new Error(`Missing VSCODE_REF in process.env`);\n\t}\n\treturn env;\n}\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/microsoft/monaco-editor/blob/ca1b42dc896b99db78e1c743256e8654e12cea2d/scripts/ci/env.ts#L1-L16","documentation":"Thrown by getNightlyEnv() when process.env.PRERELEASE_VERSION is falsy. getNightlyEnv is only called by the nightly release path, which uses PRERELEASE_VERSION to compute the prerelease tag (e.g. 0.x.x-dev.YYYYMMMM) appended to the base version. The guard ensures a nightly never ships without a prerelease suffix, which would collide with the stable version on npm. The check runs before any git clone or build step.","triggerScenarios":"Running the nightly build (`build-monaco-editor-core-pkg.ts nightly` or `build-monaco-editor-pkg.ts nightly`) in a shell or CI runner where PRERELEASE_VERSION is unset or empty. Also when a CI secret/variable was renamed or scoped to the wrong environment.","commonSituations":"CI workflow missing the env var in the nightly job; developer running nightly build locally without exporting the var; pipeline migrated to a new runner template that dropped the env injection; PRERELEASE_VERSION set on a different GitHub environment than the one the job uses.","solutions":["Export the variable before running the script: `PRERELEASE_VERSION=<value> node scripts/ci/build-monaco-editor-core-pkg.ts nightly`.","In CI, add PRERELEASE_VERSION to the job's `env:` block or to the repository/organization secrets consumed by that job.","Verify the variable is non-empty (not just defined) — an empty string also triggers the throw.","If testing locally without a real prerelease, set a throwaway value like `0.0.0-dev-test` to satisfy the guard."],"exampleFix":"// before\n$ node scripts/ci/build-monaco-editor-pkg.ts nightly\n// throws: Missing PRERELEASE_VERSION in process.env\n// after\n$ PRERELEASE_VERSION=0.34.0-dev.20240101 node scripts/ci/build-monaco-editor-pkg.ts nightly","handlingStrategy":"validation","validationCode":"if (!process.env.PRERELEASE_VERSION) {\n  console.error('PRERELEASE_VERSION is required for nightly builds.');\n  process.exit(2);\n}\n// then run the nightly build","typeGuard":"function hasPrereleaseVersion(env: NodeJS.ProcessEnv): env is NodeJS.ProcessEnv & { PRERELEASE_VERSION: string } {\n  return Boolean(env.PRERELEASE_VERSION);\n}","tryCatchPattern":null,"preventionTips":["Document required nightly env vars in the release runbook.","In CI, add a job-level `env:` assertion step that fails fast on missing vars.","Scope the secret to the correct GitHub environment so the nightly job can see it."],"tags":["ci","environment","release","nightly","configuration"],"backgroundTag":null,"analyzedSha":"ca1b42dc896b99db78e1c743256e8654e12cea2d","analyzedAt":"2026-08-13T02:00:51.380Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}