{"record":{"id":"b5334d9697d1746f","repo":"BerriAI/litellm","slug":"max-depth-of-default-max-recurse-depth-exceeded-b5334d","errorCode":null,"errorMessage":"Max depth of {DEFAULT_MAX_RECURSE_DEPTH} exceeded while processing schema. Please check the schema for excessive nesting.","messagePattern":"Max depth of (.+?) exceeded while processing schema\\. Please check the schema for excessive nesting\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/common_utils.py","lineNumber":681,"sourceCode":"    \"\"\"\n    title: Final = schema_dict.get(\"title\", None)\n    description: Final = schema_dict.get(\"description\", None)\n\n    if isinstance(schema_dict, dict) and schema_dict.get(\"anyOf\"):\n        any_of: Final = schema_dict[\"anyOf\"]\n        if (title or description) and isinstance(any_of, list) and all(isinstance(item, dict) for item in any_of):\n            for item in any_of:\n                if title:\n                    item[\"title\"] = title\n                if description:\n                    item[\"description\"] = description\n        return {\"anyOf\": any_of}\n    return schema_dict\n\n\ndef process_items(schema, depth=0):\n    if depth > DEFAULT_MAX_RECURSE_DEPTH:\n        raise ValueError(\n            f\"Max depth of {DEFAULT_MAX_RECURSE_DEPTH} exceeded while processing schema. Please check the schema for excessive nesting.\"\n        )\n    if isinstance(schema, dict):\n        # Vertex requires `items` whenever `type == \"array\"` (even inside anyOf).\n        # Normalize: empty `items: {}` and missing-items both become {\"type\": \"object\"}.\n        type_val: Final = schema.get(\"type\")\n        if (\n            (\n                isinstance(type_val, str)\n                and type_val.lower() == \"array\"\n                and (\"items\" not in schema or schema.get(\"items\") == {})\n            )\n            or schema.get(\"type\") == \"array\"\n            and \"items\" not in schema\n        ):\n            schema[\"items\"] = {\"type\": \"object\"}\n        for key, value in schema.items():\n            if isinstance(value, dict):","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/common_utils.py#L663-L699","documentation":"Guard in the recursive schema processor: flattening/simplifying a JSON schema (e.g. anyOf handling) exceeded DEFAULT_MAX_RECURSE_DEPTH, protecting against pathological or cyclic schemas that would hang or blow the stack. The input at fault is the tool/response schema passed to Vertex AI.","triggerScenarios":"Triggered when schema processing exceeds DEFAULT_MAX_RECURSE_DEPTH; check the schema for excessive nesting.","commonSituations":"See trigger scenarios.","solutions":["Reduce excessive nesting in the schema.","Simplify the response_format / tool schema being sent."],"exampleFix":"# flatten nested object definitions in the schema.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}