{"record":{"id":"fce5ed802256ea06","repo":"OpenAPITools/openapi-generator","slug":"recursionlimit-must-be-an-integer-e-g-2000-fce5ed","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/PythonPydanticV1ClientCodegen.java","lineNumber":254,"sourceCode":"            testFolder = packagePath() + File.separatorChar + testFolder;\n            // api/model docs in <package>/docs\n            apiDocPath = packagePath() + \"/\" + apiDocPath;\n            modelDocPath = packagePath() + \"/\" + modelDocPath;\n        }\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(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":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java#L236-L272","documentation":"The python-pydantic-v1 generator (Pydantic 1.x models) accepts the same recursionLimit option as the main python generator, and validates it identically in processOpts(): the value must be a String parseable by Integer.parseInt, otherwise IllegalArgumentException('recursionLimit must be an integer, e.g. 2000.') is thrown before generation.","triggerScenarios":"openapi-generator-cli generate -g python-pydantic-v1 -c recursionLimit=high / recursionLimit=100.5 / recursionLimit='' ; or plugin/maven config with a non-integer value.","commonSituations":"Reusing a working python-generator config against -g python-pydantic-v1 after someone 'fixed' the value into a float or word; CI templating that injects an empty default when the variable is unset.","solutions":["Pass a plain integer string: -c recursionLimit=2000","Guard CI templates: ${RECURSION_LIMIT:-2000} so an unset variable never yields an empty value","Remove the option if the default recursion limit is acceptable","If setting programmatically, put a String value, not a boxed numeric"],"exampleFix":"# before\nopenapi-generator-cli generate -i api.yaml -g python-pydantic-v1 -c recursionLimit=1e4\n# after\nopenapi-generator-cli generate -i api.yaml -g python-pydantic-v1 -c recursionLimit=10000","handlingStrategy":"validation","validationCode":"# bash\n[[ \"${RECURSION_LIMIT:-}\" =~ ^-?[0-9]+$ ]] || unset RECURSION_LIMIT  # let the generator default apply\nopenapi-generator-cli generate -i api.yaml -g python-pydantic-v1 ${RECURSION_LIMIT:+-c recursionLimit=$RECURSION_LIMIT}","typeGuard":null,"tryCatchPattern":"try {\n    codegen.additionalProperties().put(\"recursionLimit\", \"2000\"); // integer string only\n    new DefaultGenerator().opts(input).generate();\n} catch (IllegalArgumentException e) {\n    // 'recursionLimit must be an integer' - correct the value and rerun; nothing was partially generated\n}","preventionTips":["Use a plain integer string for recursionLimit on python-pydantic-v1","Share one canonical config snippet for the option across python and python-pydantic-v1 jobs","Skip the option entirely when the default limit is sufficient"],"tags":["python","pydantic","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"}