{"record":{"id":"74c0e87176c73985","repo":"PrefectHQ/fastmcp","slug":"no-value-is-valid-against-a-false-schema","errorCode":null,"errorMessage":"No value is valid against a false schema","messagePattern":"No value is valid against a false schema","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/utilities/json_schema_type.py","lineNumber":114,"sourceCode":"    dataclass fields.  This function recursively normalises them to strings.\n    \"\"\"\n    if isinstance(obj, datetime):\n        return obj.isoformat()\n    if isinstance(obj, date):\n        return obj.isoformat()\n    if isinstance(obj, dict):\n        return {\n            str(k) if not isinstance(k, str) else k: _normalize_yaml_types(v)\n            for k, v in obj.items()\n        }\n    if isinstance(obj, list):\n        return [_normalize_yaml_types(v) for v in obj]\n    return obj\n\n\ndef _reject_all(v: Any) -> Any:\n    \"\"\"Validator that rejects every value, implementing JSON Schema `false`.\"\"\"\n    raise ValueError(\"No value is valid against a false schema\")\n\n\n# JSON Schema `false` means no value is valid. This type rejects everything\n# during Pydantic validation.\n_UnsatisfiableType = Annotated[Any, BeforeValidator(_reject_all)]\n\nFORMAT_TYPES: dict[str, Any] = {\n    \"date-time\": datetime,\n    \"email\": EmailStr,\n    \"uri\": AnyUrl,\n    \"json\": Json,\n}\n\n_classes: dict[tuple[str, Any], type | None] = {}\n\n\nclass JSONSchema(TypedDict):\n    type: NotRequired[str | list[str]]","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/utilities/json_schema_type.py#L96-L132","documentation":"JSON Schema `false` describes a schema that no value can satisfy. `json_schema_type` implements this with `_UnsatisfiableType`, a Pydantic BeforeValidator that always raises ValueError('No value is valid against a false schema'), so validating any value against it fails — mirroring the JSON Schema semantics inside Pydantic.","triggerScenarios":"Converting a JSON schema that is (or contains, after normalization) `false` into a Python type, then validating any data against the generated Pydantic model — e.g. a property typed as `false` in a tool/elicitation schema.","commonSituations":"Server-side tool/elicitation schemas generated from stricter JSON Schema dialects that emit `false` for impossible types; hand-written schemas where `false` was meant to be `{}` or a real type.","solutions":["Fix the source schema: replace `false` with a valid subschema or `{}` (any).","Remove the impossible property from the schema.","If the false schema is intentional, do not validate data against it — treat it as always-invalid by design."],"exampleFix":"// before\nschema = {'type': 'object', 'properties': {'x': False}}\n// after\nschema = {'type': 'object', 'properties': {'x': {'type': 'string'}}}","handlingStrategy":"validation","validationCode":"def check_no_false_schema(schema: dict) -> bool:\n    if schema is False:\n        return False\n    if isinstance(schema, dict):\n        for v in schema.get('properties', {}).values():\n            if v is False or not check_no_false_schema(v):\n                return False\n    return True","typeGuard":null,"tryCatchPattern":"try:\n    model = json_schema_to_type(schema)\n    result = model.model_validate(data)\nexcept ValueError as e:\n    if 'false schema' in str(e):\n        raise SchemaDesignError('schema contains an unsatisfiable (false) subschema') from e\n    raise","preventionTips":["Lint JSON schemas for `false` subschemas before conversion","Replace impossible schemas with '{}' or a real type","Test generated models with sample data before deploying tools"],"tags":["json-schema","validation","pydantic"],"backgroundTag":"schema-validation-failed","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}