PrefectHQ/fastmcp · error · ValueError

No value is valid against a false schema

Error message

No value is valid against a false schema

What it means

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.

Source

Thrown at fastmcp_slim/fastmcp/utilities/json_schema_type.py:114

    dataclass fields.  This function recursively normalises them to strings.
    """
    if isinstance(obj, datetime):
        return obj.isoformat()
    if isinstance(obj, date):
        return obj.isoformat()
    if isinstance(obj, dict):
        return {
            str(k) if not isinstance(k, str) else k: _normalize_yaml_types(v)
            for k, v in obj.items()
        }
    if isinstance(obj, list):
        return [_normalize_yaml_types(v) for v in obj]
    return obj


def _reject_all(v: Any) -> Any:
    """Validator that rejects every value, implementing JSON Schema `false`."""
    raise ValueError("No value is valid against a false schema")


# JSON Schema `false` means no value is valid. This type rejects everything
# during Pydantic validation.
_UnsatisfiableType = Annotated[Any, BeforeValidator(_reject_all)]

FORMAT_TYPES: dict[str, Any] = {
    "date-time": datetime,
    "email": EmailStr,
    "uri": AnyUrl,
    "json": Json,
}

_classes: dict[tuple[str, Any], type | None] = {}


class JSONSchema(TypedDict):
    type: NotRequired[str | list[str]]

View on GitHub (pinned to 1f02114297)

Solutions

  1. Fix the source schema: replace `false` with a valid subschema or `{}` (any).
  2. Remove the impossible property from the schema.
  3. If the false schema is intentional, do not validate data against it — treat it as always-invalid by design.

Example fix

// before
schema = {'type': 'object', 'properties': {'x': False}}
// after
schema = {'type': 'object', 'properties': {'x': {'type': 'string'}}}
Defensive patterns

Strategy: validation

Validate before calling

def check_no_false_schema(schema: dict) -> bool:
    if schema is False:
        return False
    if isinstance(schema, dict):
        for v in schema.get('properties', {}).values():
            if v is False or not check_no_false_schema(v):
                return False
    return True

Try / catch

try:
    model = json_schema_to_type(schema)
    result = model.model_validate(data)
except ValueError as e:
    if 'false schema' in str(e):
        raise SchemaDesignError('schema contains an unsatisfiable (false) subschema') from e
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of PrefectHQ/fastmcp@1f02114297 (2026-08-29). Data as JSON: /api/errors/74c0e87176c73985. Report an issue: GitHub.