{"record":{"id":"adc02c503918f3f4","repo":"PrefectHQ/fastmcp","slug":"elicitation-expected-an-empty-response-but-receiv","errorCode":null,"errorMessage":"Elicitation expected an empty response, but received: {content}","messagePattern":"Elicitation expected an empty response, but received: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/elicitation.py","lineNumber":338,"sourceCode":"        AcceptedElicitation with the extracted/validated data\n    \"\"\"\n    # For raw schemas (dict/nested-list syntax), extract value directly\n    if config.is_raw:\n        if not isinstance(content, dict) or \"value\" not in content:\n            raise ValueError(\"Elicitation response missing required 'value' field.\")\n        return AcceptedElicitation[Any](data=content[\"value\"])\n\n    # For typed schemas, validate with Pydantic\n    if config.response_type is not None:\n        type_adapter = get_cached_typeadapter(config.response_type)\n        validated_data = type_adapter.validate_python(content)\n        if isinstance(validated_data, ScalarElicitationType):\n            return AcceptedElicitation[Any](data=validated_data.value)\n        return AcceptedElicitation[Any](data=validated_data)\n\n    # For None response_type, expect empty response\n    if content:\n        raise ValueError(\n            f\"Elicitation expected an empty response, but received: {content}\"\n        )\n    return AcceptedElicitation[dict[str, Any]](data={})\n\n\ndef _dict_to_enum_schema(\n    enum_dict: dict[str, dict[str, str]], multi_select: bool = False\n) -> dict[str, Any]:\n    \"\"\"Convert dict enum to SEP-1330 compliant schema pattern.\n\n    Args:\n        enum_dict: {\"low\": {\"title\": \"Low Priority\"}, \"medium\": {\"title\": \"Medium Priority\"}}\n        multi_select: If True, use anyOf pattern; if False, use oneOf pattern\n\n    Returns:\n        {\"type\": \"string\", \"oneOf\": [...]} for single-select\n        {\"anyOf\": [...]} for multi-select (used as array items)\n    \"\"\"","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/elicitation.py#L320-L356","documentation":"When response_type resolves to None for the accept handler (an elicitation configured with no expected data), the response content must be empty. FastMCP raises this error if the client sent back any content, since there is nowhere valid to put it. This form is deprecated — elicit() now requires a response_type.","triggerScenarios":"Calling handle_elicit_accept with a config whose response_type is None and a non-empty content dict; historically from ctx.elicit() called without a response_type whose client still submitted data.","commonSituations":"Legacy code using the removed response_type=None form; a client submitting form data for an elicitation that declared an empty schema; stale clients cached from before a server changed its elicitation type.","solutions":["Pass an explicit response_type (e.g. bool for a confirmation) to ctx.elicit() — response_type=None is deprecated/removed in FastMCP 4.0","Update the client so it returns empty content {} for empty-schema elicitations","Clear stale client state or restart the client so it re-fetches the current elicitation schema"],"exampleFix":"// before\nawait ctx.elicit()  # response_type=None\n// after\nawait ctx.elicit(response_type=bool)","handlingStrategy":"try-catch","validationCode":"# Before eliciting, ensure a response_type is supplied\nif response_type is None:\n    raise TypeError(\"ctx.elicit() requires a response_type (e.g. bool)\")","typeGuard":"def expects_empty_response(config) -> bool:\n    return config.response_type is None","tryCatchPattern":"try:\n    accepted = await ctx.elicit(response_type=bool)\nexcept ValueError as e:\n    if \"expected an empty response\" in str(e):\n        logger.warning(\"stale client sent data for an empty elicitation; ignoring\")\n        return None\n    raise","preventionTips":["Always pass a response_type to ctx.elicit(); response_type=None is deprecated (3.2) and removed (4.0)","Use bool or a small model for confirmations instead of the empty form","Restart/upgrade clients after changing a server's elicitation schema","Never hand-construct empty-schema elicitations in tests"],"tags":["elicitation","deprecated-api","fastmcp","mcp-client"],"backgroundTag":"unexpected-response-payload","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}