angular/angular-cli · warning

Workspace extension with invalid name (${name}) found.

Error message

Workspace extension with invalid name (${name}) found.

What it means

While parsing angular.json, the workspace reader warns when a top-level key is treated as a workspace extension but its name is neither a known unprefixed extension nor matches the required 'aaa-*' (1-3 lowercase letters followed by a dash) prefix convention.

Source

Thrown at packages/angular_devkit/core/src/workspace/json/reader.ts:118

  }

  // TODO: `getNodeValue` - looks potentially expensive since it walks the whole tree and instantiates the full object structure each time.
  // Might be something to look at moving forward to optimize.
  const workspaceNodeValue = getNodeValue(workspaceNode);
  for (const [name, value] of Object.entries<JsonValue>(workspaceNodeValue)) {
    if (name === '$schema' || name === 'version') {
      // skip
    } else if (name === 'projects') {
      const nodes = findNodeAtLocation(workspaceNode, ['projects']);
      if (!isJsonObject(value) || !nodes) {
        context.error('Invalid "projects" field found; expected an object.', value);
        continue;
      }

      projects = parseProjectsObject(nodes, context);
    } else {
      if (!context.unprefixedWorkspaceExtensions.has(name) && !/^[a-z]{1,3}-.*/.test(name)) {
        context.warn(`Workspace extension with invalid name (${name}) found.`, name);
      }
      if (extensions) {
        extensions[name] = value;
      }
    }
  }

  let collectionListener: DefinitionCollectionListener<ProjectDefinition> | undefined;
  if (context.trackChanges) {
    collectionListener = (name, newValue) => {
      jsonMetadata.addChange(['projects', name], newValue, 'project');
    };
  }

  const projectCollection = new ProjectDefinitionCollection(projects, collectionListener);

  return {
    [JsonWorkspaceSymbol]: jsonMetadata,

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Rename the key to the namespaced form 'xxx-name' (1-3 lowercase letters, a dash, then the name), e.g. 'x-custom' or 'nx-custom'.
  2. If it was a typo of a built-in extension (cli, schematics, etc.), correct the spelling.
  3. Move unrelated settings out of angular.json into a separate config file.

Example fix

// before (angular.json)
{ "version": 1, "myConfig": {} }
// after
{ "version": 1, "x-myConfig": {} }
Defensive patterns

Strategy: validation

Validate before calling

const RESERVED = new Set(['version', 'projects', 'cli', 'schematics', 'newProjectRoot', 'defaultProject']);
const json = require('./angular.json');
for (const key of Object.keys(json)) {
  if (!RESERVED.has(key) && !/^[a-z]{1,3}-.*/.test(key)) {
    console.warn(`Invalid workspace extension name: ${key} (use 'xxx-name' form)`);
  }
}

Type guard

function isValidExtensionName(name) {
  return /^[a-z]{1,3}-.*/.test(name);
}

Prevention

When it happens

Trigger: parseWorkspace encounters a top-level key outside the reserved set (version, projects, etc.) whose name fails /^[a-z]{1,3}-.*/ and is not in unprefixedWorkspaceExtensions (e.g. 'myExtension' or 'CLI_config').

Common situations: Hand-edited angular.json adding custom config keys at the root; tools writing vendor settings into the wrong file; typos in known extension names (e.g. 'schemetics' instead of 'schematics').

Related errors


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