{"record":{"id":"4b69362dff7ed1f7","repo":"angular/angular-cli","slug":"options-type-is-an-unknown-configuration-file","errorCode":null,"errorMessage":"\"${options.type}\" is an unknown configuration file type.","messagePattern":"\"(.+?)\" is an unknown configuration file type\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/schematics/angular/config/index.ts","lineNumber":38,"sourceCode":"} from '@angular-devkit/schematics';\nimport { posix as path } from 'node:path';\nimport { relativePathToWorkspaceRoot } from '../utility/paths';\nimport { createProjectSchematic } from '../utility/project';\nimport { updateWorkspace } from '../utility/workspace';\nimport { Builders as AngularBuilder } from '../utility/workspace-models';\nimport { Schema as ConfigOptions, Type as ConfigType } from './schema';\n\nconst configSchematic: RuleFactory<ConfigOptions> = createProjectSchematic(\n  (options, { project }) => {\n    switch (options.type) {\n      case ConfigType.Karma:\n        return addKarmaConfig(options);\n      case ConfigType.Browserslist:\n        return addBrowserslistConfig(project.root);\n      case ConfigType.Vitest:\n        return addVitestConfig(options);\n      default:\n        throw new SchematicsException(`\"${options.type}\" is an unknown configuration file type.`);\n    }\n  },\n);\n\nexport default configSchematic;\n\nfunction addVitestConfig(options: ConfigOptions): Rule {\n  return (tree, context) =>\n    updateWorkspace((workspace) => {\n      const project = workspace.projects.get(options.project);\n      if (!project) {\n        throw new SchematicsException(`Project name \"${options.project}\" doesn't not exist.`);\n      }\n\n      const testTarget = project.targets.get('test');\n      if (!testTarget) {\n        throw new SchematicsException(\n          `No \"test\" target found for project \"${options.project}\".` +","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/config/index.ts#L20-L56","documentation":"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.","triggerScenarios":"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`).","commonSituations":"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.","solutions":["Use a supported type value: e.g. `ng g config --type=karma`, `--type=browserslist`, or `--type=vitest`","Check `ng generate config --help` for the current list of accepted types","Correct the typo in the --type flag","For unsupported tooling (jest/eslint), configure the tool manually or via its own schematics"],"exampleFix":"// before\nng g config --type=jest\n// after\nng g config --type=vitest","handlingStrategy":"validation","validationCode":"const SUPPORTED_TYPES = ['karma', 'browserslist', 'vitest'];\nif (!SUPPORTED_TYPES.includes(options.type)) {\n  throw new Error(`Unsupported config type \"${options.type}\". Supported: ${SUPPORTED_TYPES.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ngGenerate('config', { type: configType });\n} catch (e) {\n  if (e.message.includes('unknown configuration file type')) {\n    console.error(`Invalid --type \"${configType}\"; see ng generate config --help`);\n  } else throw e;\n}","preventionTips":["Check `ng generate config --help` for accepted --type values before scripting","Watch for removed config types after CLI upgrades (e.g. karma in newer versions)","Never guess type names; typo-check the flag value"],"tags":["schematics","configuration","cli","validation"],"backgroundTag":"unsupported-option-value","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}