angular/angular-cli · error · SchematicsException

"${options.type}" is an unknown configuration file type.

Error message

"${options.type}" is an unknown configuration file type.

What it means

The `config` schematic can generate configuration files of specific types (e.g. karma, browserslist, vitest). An unknown `type` option falls through to the switch's default branch and throws a SchematicsException naming the rejected type.

Source

Thrown at packages/schematics/angular/config/index.ts:38

} from '@angular-devkit/schematics';
import { posix as path } from 'node:path';
import { relativePathToWorkspaceRoot } from '../utility/paths';
import { createProjectSchematic } from '../utility/project';
import { updateWorkspace } from '../utility/workspace';
import { Builders as AngularBuilder } from '../utility/workspace-models';
import { Schema as ConfigOptions, Type as ConfigType } from './schema';

const configSchematic: RuleFactory<ConfigOptions> = createProjectSchematic(
  (options, { project }) => {
    switch (options.type) {
      case ConfigType.Karma:
        return addKarmaConfig(options);
      case ConfigType.Browserslist:
        return addBrowserslistConfig(project.root);
      case ConfigType.Vitest:
        return addVitestConfig(options);
      default:
        throw new SchematicsException(`"${options.type}" is an unknown configuration file type.`);
    }
  },
);

export default configSchematic;

function addVitestConfig(options: ConfigOptions): Rule {
  return (tree, context) =>
    updateWorkspace((workspace) => {
      const project = workspace.projects.get(options.project);
      if (!project) {
        throw new SchematicsException(`Project name "${options.project}" doesn't not exist.`);
      }

      const testTarget = project.targets.get('test');
      if (!testTarget) {
        throw new SchematicsException(
          `No "test" target found for project "${options.project}".` +

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Use a supported type value: e.g. `ng g config --type=karma`, `--type=browserslist`, or `--type=vitest`
  2. Check `ng generate config --help` for the current list of accepted types
  3. Correct the typo in the --type flag
  4. For unsupported tooling (jest/eslint), configure the tool manually or via its own schematics

Example fix

// before
ng g config --type=jest
// after
ng g config --type=vitest
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_TYPES = ['karma', 'browserslist', 'vitest'];
if (!SUPPORTED_TYPES.includes(options.type)) {
  throw new Error(`Unsupported config type "${options.type}". Supported: ${SUPPORTED_TYPES.join(', ')}`);
}

Try / catch

try {
  await ngGenerate('config', { type: configType });
} catch (e) {
  if (e.message.includes('unknown configuration file type')) {
    console.error(`Invalid --type "${configType}"; see ng generate config --help`);
  } else throw e;
}

Prevention

When it happens

Trigger: Running `ng generate config --type=<value>` with a value not in the ConfigType enum (e.g. `--type=jest`, `--type=eslint`, or a typo like `--type=karama`).

Common situations: Following outdated tutorials that reference removed config types (e.g. karma removal from newer builders); typos in the --type flag; expecting editor/CI config generation the schematic never supported.

Related errors


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