{"record":{"id":"7582eecc2ee7f292","repo":"rohitg00/ai-engineering-from-scratch","slug":"invalid-length-for-location-below-minlength-mi","errorCode":null,"errorMessage":"invalid length for {location}: below minLength {minimum}","messagePattern":"invalid length for (.+?): below minLength (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"certifications/claude/lessons/10-tool-use-and-agentic-loops/code/main.py","lineNumber":147,"sourceCode":"        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}\")\n        if \"items\" in schema:\n            for index, item in enumerate(value):\n                _validate_schema_value(item, schema[\"items\"], f\"{location}[{index}]\")\n\n    if isinstance(value, dict):\n        properties = schema.get(\"properties\", {})\n        if not isinstance(properties, dict):\n            raise ValueError(f\"schema properties for {location} must be an object\")","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/certifications/claude/lessons/10-tool-use-and-agentic-loops/code/main.py#L129-L165","documentation":"String-length enforcement: the string at the named location is shorter than the schema's minLength allows; the message includes the required minimum. It fires while validating a tool argument against the locally implemented JSON-Schema subset.","triggerScenarios":"Thrown at certifications/claude/lessons/10-tool-use-and-agentic-loops/code/main.py:147 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a longer string meeting minLength","Lower minLength in the schema if the limit is too strict for valid input","Generate example inputs from the schema in tests so lengths always comply"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}