angular/angular-cli · error
Package "${packageName}" has an invalid builder schema path:
Error message
Package "${packageName}" has an invalid builder schema path: "${builderName}" --> "${builder.schema}" What it means
The Angular Architect host resolves a builder's option schema path from its package.json builders entry. This error is thrown when the declared schema path is absolute or escapes the builder package via '..' (after normalization), because schemas must be resolvable relative to within the builder's own package.
Source
Thrown at packages/angular_devkit/architect/node/node-modules-architect-host.ts:207
// Determine builder implementation path (relative within package only)
const implementationPath = builder.implementation && path.normalize(builder.implementation);
if (!implementationPath) {
throw new Error('Could not find the implementation for builder ' + builderStr);
}
if (path.isAbsolute(implementationPath) || implementationPath.startsWith('..')) {
throw new Error(
`Package "${packageName}" has an invalid builder implementation path: "${builderName}" --> "${builder.implementation}"`,
);
}
// Determine builder option schema path (relative within package only)
let schemaPath = builder.schema;
if (!schemaPath) {
throw new Error('Could not find the schema for builder ' + builderStr);
}
if (path.isAbsolute(schemaPath) || path.normalize(schemaPath).startsWith('..')) {
throw new Error(
`Package "${packageName}" has an invalid builder schema path: "${builderName}" --> "${builder.schema}"`,
);
}
// The file could be either a package reference or in the local manifest directory.
if (schemaPath.startsWith('.')) {
schemaPath = path.join(buildersManifestDirectory, schemaPath);
} else {
const manifestRequire = createRequire(buildersManifestDirectory + '/');
schemaPath = manifestRequire.resolve(schemaPath);
}
const schemaText = readFileSync(schemaPath, 'utf-8');
return Promise.resolve({
name: builderStr,
builderName,
description: builder['description'],View on GitHub (pinned to bb72145f9a)
Solutions
- Edit the builder's package.json so the schema field is a relative path inside the package, e.g. "schema": "./schema.json"
- Verify the schema file actually exists inside the published/packaged builder (files field in package.json)
- If escaping is truly needed, publish a wrapper package containing the schema instead
Example fix
// before (builder package.json) "builders": "builders.json", "schema": "/home/me/shared/schema.json" // after "builders": "builders.json", "schema": "./schema.json"
Defensive patterns
Strategy: validation
Validate before calling
const pkg = require(builderPkgJsonPath);
for (const [name, b] of Object.entries(pkg.builders || {})) {
const s = b.schema;
if (path.isAbsolute(s) || path.normalize(s).startsWith('..')) {
throw new Error(`Builder ${name} schema must be a relative in-package path: ${s}`);
}
} Type guard
function hasValidSchemaPath(b) {
return typeof b?.schema === 'string' && b.schema.length > 0 &&
!path.isAbsolute(b.schema) && !path.normalize(b.schema).startsWith('..');
} Try / catch
try {
const info = await host.resolveBuilder('my-pkg:my-builder');
} catch (e) {
if (e.message.includes('invalid builder schema path')) {
console.error('Fix the schema path in the builder package.json to a relative in-package path');
}
throw e;
} Prevention
- Always use relative schema paths like './schema.json' in builders.json/package.json
- Publish builder packages and test them with `npm pack` + install in a scratch project
- Never reference schemas outside the builder package root
When it happens
Trigger: Calling architectHost.resolveBuilder('pkg:builder') where the builder's package.json lists a schema path like '/abs/path/schema.json' or '../../outside/schema.json' (or a path that normalizes to start with '..').
Common situations: Hand-written or misconfigured builder packages with an absolute path in package.json; paths assuming the consumer's working directory; builders migrated between machines/monorepos where a previously-absolute path was hardcoded.
Related errors
- Invalid toPath: The string must start with a '/'. Received:
- Invalid fromPath: The string must start with a '/'. Received
- Builder is not a builder
- Invalid target string:
- Cannot load builder for builderInfo ${JSON.stringify(info, n
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/992fc06d12357f3b.
Report an issue: GitHub.