{"record":{"id":"9999499adb180415","repo":"pnpm/pnpm","slug":"missing-runtime-name","errorCode":"MISSING_RUNTIME_NAME","errorMessage":"\"pnpm runtime set <name> <version>\" requires a runtime name (e.g. node, deno, bun)","messagePattern":"\"pnpm runtime set <name> <version>\" requires a runtime name \\(e\\.g\\. node, deno, bun\\)","errorType":"exception","errorClass":"PnpmError","httpStatus":null,"severity":"error","filePath":"pnpm11/engine/runtime/commands/src/runtime/runtime.ts","lineNumber":104,"sourceCode":"    })\n  }\n  switch (params[0]) {\n    case 'set': {\n      runtimeSet(opts, params.slice(1))\n      return\n    }\n    default: {\n      throw new PnpmError('RUNTIME_UNKNOWN_SUBCOMMAND', `Unknown subcommand: ${params[0]}`, {\n        hint: help(),\n      })\n    }\n  }\n}\n\nfunction runtimeSet (opts: RuntimeCommandOptions, params: string[]): void {\n  const runtimeName = params[0]?.trim()\n  if (!runtimeName) {\n    throw new PnpmError('MISSING_RUNTIME_NAME', '\"pnpm runtime set <name> <version>\" requires a runtime name (e.g. node, deno, bun)')\n  }\n  // The runtime name is interpolated into an `add` selector, so reject\n  // anything that isn't a known runtime before it can be misread as a\n  // comma-separated package list or a local path by the install pipeline.\n  if (!isRuntimeAlias(runtimeName)) {\n    throw new PnpmError('INVALID_RUNTIME_NAME', `\"${runtimeName}\" is not a supported runtime. Supported runtimes are: ${RUNTIME_NAMES.join(', ')}`)\n  }\n\n  const versionSpec = params[1]?.trim()\n  // The version is interpolated into the same selector, which the global-add\n  // pipeline splits on commas. Reject a comma so `runtime set node 22,evil -g`\n  // can't smuggle in a second install target. No valid runtime version\n  // (semver, dist-tag, channel) contains one.\n  if (versionSpec?.includes(',')) {\n    throw new PnpmError('INVALID_RUNTIME_VERSION', `Invalid runtime version \"${versionSpec}\": a version cannot contain a comma`)\n  }\n\n  const args = ['add', `${runtimeName}@runtime:${versionSpec ?? ''}`]","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/pnpm/pnpm/blob/5b11d3a15b9022a2109cb18ed96a5d652630371f/pnpm11/engine/runtime/commands/src/runtime/runtime.ts#L86-L122","documentation":"Inside `pnpm runtime set`, the first remaining parameter is the runtime name; it is trimmed and required, and an empty result throws MISSING_RUNTIME_NAME with the expected shape ('pnpm runtime set <name> <version>' requires a runtime name (e.g. node, deno, bun)). This is the first of three validation layers in runtimeSet (name presence, name validity, version comma check) before anything is passed to the install pipeline.","triggerScenarios":"`pnpm runtime set` with no further arguments, or `pnpm runtime set '' 22` where the name trims to empty.","commonSituations":"Scripts forwarding an unset runtime variable; users expecting an interactive prompt; copy-paste commands missing the name token.","solutions":["Provide one of node, deno, or bun: `pnpm runtime set node 22 -g`.","Default script variables: `pnpm runtime set \"${RUNTIME:-node}\" \"${VERSION:-lts}\" -g`.","Check `pnpm runtime set --help` if unsure of the argument order."],"exampleFix":"# before\npnpm runtime set -g          # ERR_PNPM_MISSING_RUNTIME_NAME\n# after\npnpm runtime set node 22 -g","handlingStrategy":"validation","validationCode":"const runtimeName = params[0]?.trim()\nif (!runtimeName) {\n  throw new Error('pnpm runtime set requires a runtime name: node, deno, or bun')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default the runtime in scripts: pnpm runtime set \"${RUNTIME:-node}\" <version> -g.","Fail fast when a parameterized runtime variable is empty rather than letting pnpm reject it."],"tags":["cli","runtime-command","usage","arguments"],"backgroundTag":null,"analyzedSha":"5b11d3a15b9022a2109cb18ed96a5d652630371f","analyzedAt":"2026-08-16T13:18:59.198Z","schemaVersion":2},"datasetVersion":"2026-08-16T18:17:16.020Z"}