{"record":{"id":"bfd5f0f57dc8eec7","repo":"OpenAPITools/openapi-generator","slug":"recursionlimit-must-be-an-integer-e-g-2000","errorCode":null,"errorMessage":"recursionLimit must be an integer, e.g. 2000.","messagePattern":"recursionLimit must be an integer, e\\.g\\. 2000\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java","lineNumber":333,"sourceCode":"        }\n        // make api and model doc path available in mustache template\n        additionalProperties.put(\"apiDocPath\", apiDocPath);\n        additionalProperties.put(\"modelDocPath\", modelDocPath);\n\n        if (additionalProperties.containsKey(SET_ENSURE_ASCII_TO_FALSE)) {\n            additionalProperties.put(SET_ENSURE_ASCII_TO_FALSE, Boolean.valueOf(additionalProperties.get(SET_ENSURE_ASCII_TO_FALSE).toString()));\n        }\n\n        if (additionalProperties.containsKey(PACKAGE_URL)) {\n            setPackageUrl((String) additionalProperties.get(PACKAGE_URL));\n        }\n\n        // check to see if setRecursionLimit is set and whether it's an integer\n        if (additionalProperties.containsKey(RECURSION_LIMIT)) {\n            try {\n                Integer.parseInt((String) additionalProperties.get(RECURSION_LIMIT));\n            } catch (NumberFormatException | NullPointerException e) {\n                throw new IllegalArgumentException(\"recursionLimit must be an integer, e.g. 2000.\");\n            }\n        }\n\n        if (additionalProperties.containsKey(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)) {\n            setUseOneOfDiscriminatorLookup(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP));\n        } else {\n            additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup);\n        }\n\n        if (additionalProperties.containsKey(MAP_NUMBER_TO)) {\n            setMapNumberTo(String.valueOf(additionalProperties.get(MAP_NUMBER_TO)));\n        }\n\n        if (additionalProperties.containsKey(DATETIME_FORMAT)) {\n            setDatetimeFormat((String) additionalProperties.get(DATETIME_FORMAT));\n        } else {\n            additionalProperties.put(DATETIME_FORMAT, datetimeFormat);\n        }","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java#L315-L351","documentation":"The python generator accepts a recursionLimit additional-property that ends up as sys.setrecursionlimit() in the generated client. During processOpts() the value is cast to String and passed to Integer.parseInt; anything that is not a base-10 integer string throws IllegalArgumentException('recursionLimit must be an integer, e.g. 2000.') before any file is written.","triggerScenarios":"openapi-generator-cli generate -g python -c recursionLimit=20.00 / recursionLimit=true / recursionLimit='' ; or a Maven/Gradle/plugin config where <recursionLimit>2_000</recursionLimit> is used. The value must arrive as a string like 2000.","commonSituations":"Copy-pasting the option with a unit, a decimal, or a thousands separator; YAML configs that coerce the value to a boolean or leave it empty; scripts templating the flag from an unset environment variable producing an empty string.","solutions":["Pass a plain integer string: -c recursionLimit=2000","In Maven/Gradle plugin config use <recursionLimit>2000</recursionLimit> with no quotes, spaces, or separators","If setting programmatically, put a String: additionalProperties.put('recursionLimit', String.valueOf(2000))","If you do not actually need it, remove the option entirely (it is optional)"],"exampleFix":"# before\nopenapi-generator-cli generate -i api.yaml -g python -c recursionLimit=3_000\n# after\nopenapi-generator-cli generate -i api.yaml -g python -c recursionLimit=3000","handlingStrategy":"validation","validationCode":"# bash: validate before running the generator\n[[ \"${RECURSION_LIMIT:-}\" =~ ^[0-9]+$ ]] || RECURSION_LIMIT=2000\nopenapi-generator-cli generate -i api.yaml -g python -c recursionLimit=${RECURSION_LIMIT}","typeGuard":null,"tryCatchPattern":"try {\n    PythonClientCodegen codegen = new PythonClientCodegen();\n    codegen.additionalProperties().put(\"recursionLimit\", String.valueOf(2000)); // always a String\n    new DefaultGenerator().opts(new ClientOptInput().opts(codegen)).generate();\n} catch (IllegalArgumentException e) {\n    // message names the offending option; fix the value and rerun, do not retry blindly\n}","preventionTips":["Always pass recursionLimit as a plain integer string with no separators or units","Template CI variables with a numeric default: ${RECURSION_LIMIT:-2000}","When configuring programmatically, put String.valueOf(int), never a boxed type"],"tags":["python","codegen","configuration","type-mismatch","openapi-generator"],"backgroundTag":"invalid-generator-option-value","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}