{"record":{"id":"6a78e27ecde994e2","repo":"mastra-ai/mastra","slug":"deployer-invalid-pnpm-build-approval-config","errorCode":"DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG","errorMessage":"Invalid pnpm ${key} configuration","messagePattern":"Invalid pnpm (.+?) configuration","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/deployer/src/services/deps.ts","lineNumber":72,"sourceCode":"    .map(specifier => specifier.trim())\n    .filter(Boolean)\n    .map(specifier => {\n      if (specifier.startsWith('@')) {\n        const versionSeparator = specifier.indexOf('@', 1);\n        return versionSeparator === -1 ? specifier : specifier.slice(0, versionSeparator);\n      }\n      return specifier.split('@', 1)[0]!;\n    });\n}\n\nfunction validatePnpmBuildApprovals(key: string, block: string): void {\n  if (key !== 'allowBuilds' && key !== 'onlyBuiltDependencies') return;\n\n  let value: unknown;\n  try {\n    value = (parse(block) as Record<string, unknown>)[key];\n  } catch (error) {\n    throw new MastraError(\n      {\n        id: 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG',\n        domain: ErrorDomain.DEPLOYER,\n        category: ErrorCategory.USER,\n        details: { key },\n        text: `Invalid pnpm ${key} configuration`,\n      },\n      error,\n    );\n  }\n\n  const invalidEntries =\n    key === 'allowBuilds'\n      ? value && typeof value === 'object' && !Array.isArray(value)\n        ? Object.entries(value).filter(\n            ([dependency, approval]) => dependency.trim().length === 0 || typeof approval !== 'boolean',\n          )\n        : [[key, value]]","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/deployer/src/services/deps.ts#L54-L90","documentation":"validatePnpmBuildApprovals parses pnpm-workspace.yaml blocks for allowBuilds or onlyBuiltDependencies keys and throws DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG if the YAML block cannot be parsed or the key's value is not in the expected shape. Categorized as USER because the input is project configuration. Details include the offending key.","triggerScenarios":"copyPnpmWorkspaceSettings encounters a pnpm-workspace.yaml whose allowBuilds/onlyBuiltDependencies value is malformed — e.g. onlyBuiltDependencies is a string instead of an array, or the YAML around it fails to parse.","commonSituations":"Hand-editing pnpm-workspace.yaml with wrong indentation; writing onlyBuiltDependencies: eslint instead of a YAML list; mixing pnpm v9 (onlyBuiltDependencies) and v10 (allowBuilds) syntax incorrectly.","solutions":["Open pnpm-workspace.yaml and fix the allowBuilds/onlyBuiltDependencies value to the correct YAML type (list of package names).","Validate the file with `pnpm install` — pnpm will also report YAML parse errors.","Run `pnpm approve-builds` to generate a correctly-shaped configuration."],"exampleFix":"# before\nonlyBuiltDependencies: sharp\n# after\nonlyBuiltDependencies:\n  - sharp","handlingStrategy":"validation","validationCode":"const yaml = require('yaml');\nconst ws = yaml.parse(require('fs').readFileSync('pnpm-workspace.yaml', 'utf8'));\nfor (const key of ['allowBuilds', 'onlyBuiltDependencies']) {\n  if (key in ws && !Array.isArray(ws[key])) {\n    throw new Error(`pnpm-workspace.yaml: ${key} must be a YAML list of package names`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await deploy();\n} catch (e) {\n  if (e?.id === 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG') {\n    console.error(`Fix pnpm-workspace.yaml key '${e.details?.key}': value must be a list of package names.`);\n  }\n  throw e;\n}","preventionTips":["Validate pnpm-workspace.yaml with `pnpm install` before deploying","Use lists for allowBuilds/onlyBuiltDependencies, one package name per item","Run `pnpm approve-builds` instead of hand-editing the block"],"tags":["pnpm","configuration","yaml","validation"],"backgroundTag":"invalid-pnpm-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}