{"record":{"id":"3c13907dcbd49235","repo":"FoundationAgents/MetaGPT","slug":"there-is-no-input-data-and-form-data","errorCode":null,"errorMessage":"There is no input data and form data","messagePattern":"There is no input data and form data","errorType":"validation","errorClass":"InputDataRequired","httpStatus":null,"severity":"error","filePath":"metagpt/provider/dashscope_api.py","lineNumber":89,"sourceCode":"            http_url += function\n        request = AioHttpRequest(\n            url=http_url,\n            api_key=api_key,\n            http_method=http_method,\n            stream=stream,\n            async_request=async_request,\n            query=query,\n            timeout=request_timeout,\n            task_id=task_id,\n        )\n    else:\n        raise UnsupportedApiProtocol(\"Unsupported protocol: %s, support [http, https, websocket]\" % api_protocol)\n\n    if headers is not None:\n        request.add_headers(headers=headers)\n\n    if input is None and form is None:\n        raise InputDataRequired(\"There is no input data and form data\")\n\n    request_data = ApiRequestData(\n        model,\n        task_group=task_group,\n        task=task,\n        function=function,\n        input=input,\n        form=form,\n        is_binary_input=is_binary_input,\n        api_protocol=api_protocol,\n    )\n    request_data.add_resources(resources)\n    request_data.add_parameters(**kwargs)\n    request.data = request_data\n    return request\n\n\nclass AGeneration(Generation, BaseAioApi):","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/provider/dashscope_api.py#L71-L107","documentation":"Vendored DashScope request builder: after constructing the request object it requires a payload — if both input and form are None, InputDataRequired('There is no input data and form data') is raised. It means the API call was shaped without any content to send.","triggerScenarios":"Invoking the dashscope aigc request path with input=None and form=None — e.g. building a request where the prompt/messages were never attached, or calling the builder directly with empty arguments.","commonSituations":"Direct use of the vendored helper functions with partial arguments; upstream bugs where the messages list is empty so input is never populated; parameter reshuffling during upgrades leaving payload fields None.","solutions":["Ensure a non-empty prompt/messages (or form payload) is passed so input gets populated.","Validate arguments before calling low-level builders: reject empty payloads early with your own error.","Prefer the high-level provider (dashscope_llm) which constructs payloads for you."],"exampleFix":"// before\nrequest = build_api_arequest(model=\"qwen-max\", ..., input=None, form=None)\n\n// after\nrequest = build_api_arequest(model=\"qwen-max\", ..., input={\"messages\": [{\"role\":\"user\",\"content\":\"hi\"}]}, form=None)","handlingStrategy":"validation","validationCode":"def has_payload(input, form) -> bool:\n    return input is not None or form is not None\n\nassert has_payload(input, form), \"nothing to send: provide input or form\"","typeGuard":null,"tryCatchPattern":"try:\n    request = build_api_arequest(model, input=input, form=form, ...)\nexcept Exception as e:\n    if \"no input data\" in str(e).lower():\n        raise ValueError(\"empty payload; build prompt/messages before calling\") from e\n    raise","preventionTips":["Build and assert the payload right before calling request builders.","Prefer high-level provider methods over the vendored internals."],"tags":["dashscope","validation","empty-payload"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}