angular/angular-cli · error

Could not find the schema for builder

Error message

Could not find the schema for builder 

What it means

A builder manifest entry must include a 'schema' path to the JSON options schema used for validating/deriving target options. resolveBuilder throws when the entry lacks a 'schema' value.

Source

Thrown at packages/angular_devkit/architect/node/node-modules-architect-host.ts:204

        (seenBuilders ?? new Set()).add(builderStr),
      );
    }

    // 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({

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Add a 'schema' field pointing at a relative JSON schema file in the manifest entry.
  2. Create the schema file if it doesn't exist and reference it.
  3. Publish a fixed version of the builder package.

Example fix

// before (builders.json)
"my-builder": {"implementation": "./impl.js"}
// after
"my-builder": {"implementation": "./impl.js", "schema": "./schema.json"}
Defensive patterns

Strategy: validation

Validate before calling

const schema = require(`${packageName}/builders.json`).builders?.[builderName]?.schema;
if (!schema) throw new Error(`Builder "${packageName}:${builderName}" is missing a schema path.`);

Type guard

const hasSchema = (b) => typeof b === 'object' && b !== null && typeof b.schema === 'string' && b.schema.length > 0;

Try / catch

try { await host.resolveBuilder(builderStr); } catch (e) { if (String(e.message).includes('Could not find the schema for builder')) { /* add the 'schema' field to the manifest entry */ } else throw e; }

Prevention

When it happens

Trigger: A builders.json entry like {"implementation": "./impl.js"} without 'schema'; schema field removed or mistyped while editing a manifest.

Common situations: Authoring custom builders and forgetting the schema; trimming manifest entries; alias chains resolving to a partially defined entry.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/d43bc6fecbeea375. Report an issue: GitHub.