{"record":{"id":"774541dd3d94c496","repo":"rohitg00/ai-engineering-from-scratch","slug":"required-must-be-list-str","errorCode":null,"errorMessage":"required must be list[str]","messagePattern":"required must be list\\[str\\]","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/21-tool-registry-schema-validation/code/main.py","lineNumber":151,"sourceCode":"        raise ValueError(\"minLength cannot be greater than maxLength\")\n    pattern = schema.get(\"pattern\")\n    if pattern is not None and not isinstance(pattern, str):\n        raise ValueError(\"pattern must be a string\")\n    props = schema.get(\"properties\")\n    if props is not None:\n        if not isinstance(props, dict):\n            raise ValueError(\"properties must be a dict\")\n        for pname, psub in props.items():\n            if not isinstance(pname, str):\n                raise ValueError(\"property names must be strings\")\n            validate_schema_shape(psub)\n    items = schema.get(\"items\")\n    if items is not None:\n        validate_schema_shape(items)\n    req = schema.get(\"required\")\n    if req is not None:\n        if not isinstance(req, list) or not all(isinstance(x, str) for x in req):\n            raise ValueError(\"required must be list[str]\")\n\n\ndef _path(prefix: str, segment: str | int) -> str:\n    seg = str(segment).replace(\"~\", \"~0\").replace(\"/\", \"~1\")\n    return f\"{prefix}/{seg}\"\n\n\ndef _type_matches(value: Any, expected: str) -> bool:\n    types = PRIMITIVE_TYPE_MAP[expected]\n    if expected == \"boolean\":\n        return isinstance(value, bool)\n    if expected in (\"integer\", \"number\"):\n        if isinstance(value, bool):\n            return False\n        return isinstance(value, types)\n    return isinstance(value, types)\n\n","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/21-tool-registry-schema-validation/code/main.py#L133-L169","documentation":"Error \"required must be list[str]\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/21-tool-registry-schema-validation/code/main.py:151 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"}