{"record":{"id":"6938bb3627c36bf6","repo":"sveltejs/kit","slug":"could-not-auto-detect-a-runtime-please-explicitly","errorCode":null,"errorMessage":"Could not auto-detect a runtime. Please explicitly specify a runtime in your adapter configuration.","messagePattern":"Could not auto-detect a runtime\\. Please explicitly specify a runtime in your adapter configuration\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-vercel/utils.js","lineNumber":102,"sourceCode":"\t\t}\n\n\t\treturn `bun${major}.x`;\n\t}\n\n\t// otherwise, default to the version of Node specified in the project config\n\tif (process.versions.node) {\n\t\tconst major = Number(process.versions.node.split('.')[0]);\n\n\t\tif (!valid_node_versions.includes(major)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unsupported Node.js version: ${process.version}. Please use Node ${formatter.format(valid_node_versions.map((v) => `${v}`))} to build your project, or explicitly specify a runtime in your adapter configuration.`\n\t\t\t);\n\t\t}\n\n\t\treturn `nodejs${/** @type {22 | 24} */ (major)}.x`;\n\t}\n\n\tthrow new Error(\n\t\t'Could not auto-detect a runtime. Please explicitly specify a runtime in your adapter configuration.'\n\t);\n}\n\nconst valid_runtimes = /** @type {const} */ (['nodejs22.x', 'nodejs24.x', 'bun1.x']);\n\n/**\n * @param {string} key\n * @returns {asserts key is RuntimeKey}\n */\nfunction assert_is_valid_runtime(key) {\n\tif (!valid_runtimes.includes(/** @type {RuntimeKey} */ (key))) {\n\t\tthrow new Error(\n\t\t\t`Unsupported runtime: ${key}. Supported runtimes are: ${valid_runtimes.join(', ')}. See the Node.js Version section in your Vercel project settings for info on the currently supported versions.`\n\t\t);\n\t}\n}\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-vercel/utils.js#L84-L120","documentation":"The Vercel adapter tries to auto-detect the serverless runtime from the environment (checking the installed Node.js major version). When it cannot determine a supported version, it throws and asks you to set `runtime` explicitly in the adapter options in svelte.config.js.","triggerScenarios":"Calling `key`/`get_default_runtime` during build when neither a recognizable Node.js major version (22 or 24) nor another detectable runtime is present in the build environment.","commonSituations":"Building on a Node version outside the supported set (e.g. Node 18/20/26), building in a container/CI where node version detection fails, or using Bun/edge without specifying runtime.","solutions":["Set `runtime: 'nodejs22.x'` (or 'nodejs24.x' / 'bun1.x') in the vercel adapter options in svelte.config.js","Upgrade or pin the build environment to Node.js 22 or 24 so auto-detection succeeds","Check that the CI/container is not running an EOL Node version"],"exampleFix":"// before (svelte.config.js)\nadapter: adapter()\n// after\nadapter: adapter({ runtime: 'nodejs22.x' })","handlingStrategy":"validation","validationCode":"// in svelte.config.js, before building\nconst supported = ['nodejs22.x', 'nodejs24.x', 'bun1.x'];\nif (!supported.includes(adapterOptions.runtime ?? '')) {\n  console.warn('Set adapter({ runtime }) explicitly; auto-detect will fail on this Node version:', process.version);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set `runtime` explicitly in CI where the Node version may vary","Pin Node 22 or 24 via .nvmrc / CI matrix","Check the adapter README for currently supported runtimes before upgrading"],"tags":["vercel","adapter","configuration","node-version"],"backgroundTag":"runtime-autodetect-failed","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}