mastra-ai/mastra · error · MastraError
DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG
DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG
Error message
Invalid pnpm ${key} configuration What it means
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.
Source
Thrown at packages/deployer/src/services/deps.ts:72
.map(specifier => specifier.trim())
.filter(Boolean)
.map(specifier => {
if (specifier.startsWith('@')) {
const versionSeparator = specifier.indexOf('@', 1);
return versionSeparator === -1 ? specifier : specifier.slice(0, versionSeparator);
}
return specifier.split('@', 1)[0]!;
});
}
function validatePnpmBuildApprovals(key: string, block: string): void {
if (key !== 'allowBuilds' && key !== 'onlyBuiltDependencies') return;
let value: unknown;
try {
value = (parse(block) as Record<string, unknown>)[key];
} catch (error) {
throw new MastraError(
{
id: 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG',
domain: ErrorDomain.DEPLOYER,
category: ErrorCategory.USER,
details: { key },
text: `Invalid pnpm ${key} configuration`,
},
error,
);
}
const invalidEntries =
key === 'allowBuilds'
? value && typeof value === 'object' && !Array.isArray(value)
? Object.entries(value).filter(
([dependency, approval]) => dependency.trim().length === 0 || typeof approval !== 'boolean',
)
: [[key, value]]View on GitHub (pinned to 75dd419e61)
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.
Example fix
# before onlyBuiltDependencies: sharp # after onlyBuiltDependencies: - sharp
Defensive patterns
Strategy: validation
Validate before calling
const yaml = require('yaml');
const ws = yaml.parse(require('fs').readFileSync('pnpm-workspace.yaml', 'utf8'));
for (const key of ['allowBuilds', 'onlyBuiltDependencies']) {
if (key in ws && !Array.isArray(ws[key])) {
throw new Error(`pnpm-workspace.yaml: ${key} must be a YAML list of package names`);
}
} Try / catch
try {
await deploy();
} catch (e) {
if (e?.id === 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG') {
console.error(`Fix pnpm-workspace.yaml key '${e.details?.key}': value must be a list of package names.`);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Google RBAC roleMapping is required.
- Cookie password must be at least 32 characters. Set OKTA_COO
- heartbeatMs must be a finite number no greater than ${MAX_TI
- Expected a PEM-encoded public key or certificate string for
- terminationGraceMs must be greater than zero.
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/6a78e27ecde994e2.
Report an issue: GitHub.