{"record":{"id":"0dfbc7498c81e1a2","repo":"rohitg00/ai-engineering-from-scratch","slug":"schema-keyword-for-location-must-be-numeric","errorCode":null,"errorMessage":"schema {keyword} for {location} must be numeric","messagePattern":"schema (.+?) for (.+?) must be numeric","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"certifications/claude/lessons/10-tool-use-and-agentic-loops/code/main.py","lineNumber":139,"sourceCode":"    if \"enum\" in schema:\n        choices = schema[\"enum\"]\n        if not isinstance(choices, list) or not choices:\n            raise ValueError(f\"schema enum for {location} must be a non-empty list\")\n        if value not in choices:\n            raise ValueError(f\"invalid value for {location}: not in enum\")\n\n    if isinstance(value, (int, float)) and not isinstance(value, bool):\n        for keyword, comparison, message in (\n            (\"minimum\", lambda current, bound: current >= bound, \"below minimum\"),\n            (\"maximum\", lambda current, bound: current <= bound, \"above maximum\"),\n            (\"exclusiveMinimum\", lambda current, bound: current > bound, \"at or below exclusive minimum\"),\n            (\"exclusiveMaximum\", lambda current, bound: current < bound, \"at or above exclusive maximum\"),\n        ):\n            if keyword not in schema:\n                continue\n            bound = schema[keyword]\n            if not isinstance(bound, (int, float)) or isinstance(bound, bool):\n                raise ValueError(f\"schema {keyword} for {location} must be numeric\")\n            if not comparison(value, bound):\n                raise ValueError(f\"invalid value for {location}: {message} {bound}\")\n\n    if isinstance(value, str):\n        minimum = _integer_bound(schema, \"minLength\")\n        maximum = _integer_bound(schema, \"maxLength\")\n        if minimum is not None and len(value) < minimum:\n            raise ValueError(f\"invalid length for {location}: below minLength {minimum}\")\n        if maximum is not None and len(value) > maximum:\n            raise ValueError(f\"invalid length for {location}: above maxLength {maximum}\")\n\n    if isinstance(value, list):\n        minimum = _integer_bound(schema, \"minItems\")\n        maximum = _integer_bound(schema, \"maxItems\")\n        if minimum is not None and len(value) < minimum:\n            raise ValueError(f\"invalid item count for {location}: below minItems {minimum}\")\n        if maximum is not None and len(value) > maximum:\n            raise ValueError(f\"invalid item count for {location}: above maxItems {maximum}\")","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/certifications/claude/lessons/10-tool-use-and-agentic-loops/code/main.py#L121-L157","documentation":"Error \"schema {keyword} for {location} must be numeric\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at certifications/claude/lessons/10-tool-use-and-agentic-loops/code/main.py:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}