{"record":{"id":"5703012d50e4a545","repo":"OpenAPITools/openapi-generator","slug":"invalid-ngversion-ngversion-only-angular","errorCode":null,"errorMessage":"Invalid ngVersion: \" + ngVersion + \". Only Angular v9+ is supported.","messagePattern":"Invalid ngVersion: \" \\+ ngVersion \\+ \"\\. Only Angular v9\\+ is supported\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java","lineNumber":221,"sourceCode":"        supportingFiles.add(new SupportingFile(\"configuration.mustache\", getIndexDirectory(), \"configuration.ts\"));\n        supportingFiles.add(new SupportingFile(\"api.base.service.mustache\", getIndexDirectory(), \"api.base.service.ts\"));\n        supportingFiles.add(new SupportingFile(\"variables.mustache\", getIndexDirectory(), \"variables.ts\"));\n        supportingFiles.add(new SupportingFile(\"encoder.mustache\", getIndexDirectory(), \"encoder.ts\"));\n        supportingFiles.add(new SupportingFile(\"param.mustache\", getIndexDirectory(), \"param.ts\"));\n        supportingFiles.add(new SupportingFile(\"gitignore\", \"\", \".gitignore\"));\n        supportingFiles.add(new SupportingFile(\"git_push.sh.mustache\", \"\", \"git_push.sh\"));\n        supportingFiles.add(new SupportingFile(\"queryParams.mustache\", getIndexDirectory(), \"query.params.ts\"));\n\n        if(ngVersionAtLeast_17) {\n            supportingFiles.add(new SupportingFile(\"README.mustache\", getIndexDirectory(), \"README.md\"));\n        }\n        else {\n            supportingFiles.add(new SupportingFile(\"README_beforeV17.mustache\", getIndexDirectory(), \"README.md\"));\n        }\n\n\n        if (!ngVersion.atLeast(\"9.0.0\")) {\n            throw new IllegalArgumentException(\"Invalid ngVersion: \" + ngVersion + \". Only Angular v9+ is supported.\");\n        }\n\n        if (additionalProperties.containsKey(NPM_NAME)) {\n            addNpmPackageGeneration(ngVersion);\n        }\n\n        if (additionalProperties.containsKey(STRING_ENUMS)) {\n            setStringEnums(Boolean.parseBoolean(additionalProperties.get(STRING_ENUMS).toString()));\n            additionalProperties.put(\"stringEnums\", getStringEnums());\n            if (getStringEnums()) {\n                classEnumSeparator = \"\";\n            }\n        }\n\n        if (additionalProperties.containsKey(WITH_INTERFACES)) {\n            boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString());\n            if (withInterfaces) {\n                apiTemplateFiles.put(\"apiInterface.mustache\", \"Interface.ts\");","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java#L203-L239","documentation":"The typescript-angular generator builds templates against Angular APIs that exist only since Angular 9 (Ivy renderer). During supporting-file setup it parses the ngVersion option and throws when the parsed version is below 9.0.0. The default is 22.0.0, so the error only fires when an explicit older version is passed.","triggerScenarios":"-g typescript-angular with -DngVersion=8.2.14 (any value below 9.0.0).","commonSituations":"Legacy Angular 8 apps trying to regenerate clients; typos such as ngVersion=4 instead of 14; CI configs pinned to generator options written years ago; MAJOR-only values like ngVersion=8.","solutions":["Set ngVersion to 9.0.0 or higher, e.g. -DngVersion=17.0.0.","If the app is genuinely Angular 8, pin an old openapi-generator release that still supported it, or migrate the app to a supported Angular version."],"exampleFix":"# before\nopenapi-generator generate -g typescript-angular -i api.yaml -DngVersion=8.2.14\n\n# after\nopenapi-generator generate -g typescript-angular -i api.yaml -DngVersion=17.0.0","handlingStrategy":"validation","validationCode":"# bash\npython3 -c \"import sys; from packaging.version import Version; sys.exit(0 if Version('$NG_VERSION') >= Version('9.0.0') else 1)\" \\\n  || { echo \"ngVersion must be >= 9.0.0\"; exit 1; }","typeGuard":"const isSupportedNgVersion = (v: string): boolean => {\n  const [maj] = v.split('.').map(Number);\n  return Number.isFinite(maj) && maj >= 9;\n};","tryCatchPattern":"// Java\ntry { new DefaultGenerator().opts(input).generate(); }\ncatch (IllegalArgumentException e) {\n    // ngVersion too old: bump the option to match the project's real Angular major\n}","preventionTips":["Read the Angular major straight from the app's package.json and pass it to the generator.","Keep generator options in version control next to the frontend so they move with upgrades.","Run client generation in CI to catch stale version pins."],"tags":["typescript","angular","version","configuration"],"backgroundTag":"unsupported-framework-version","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}