FoundationAgents/MetaGPT · error · InputDataRequired

There is no input data and form data

Error message

There is no input data and form data

What it means

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.

Source

Thrown at metagpt/provider/dashscope_api.py:89

            http_url += function
        request = AioHttpRequest(
            url=http_url,
            api_key=api_key,
            http_method=http_method,
            stream=stream,
            async_request=async_request,
            query=query,
            timeout=request_timeout,
            task_id=task_id,
        )
    else:
        raise UnsupportedApiProtocol("Unsupported protocol: %s, support [http, https, websocket]" % api_protocol)

    if headers is not None:
        request.add_headers(headers=headers)

    if input is None and form is None:
        raise InputDataRequired("There is no input data and form data")

    request_data = ApiRequestData(
        model,
        task_group=task_group,
        task=task,
        function=function,
        input=input,
        form=form,
        is_binary_input=is_binary_input,
        api_protocol=api_protocol,
    )
    request_data.add_resources(resources)
    request_data.add_parameters(**kwargs)
    request.data = request_data
    return request


class AGeneration(Generation, BaseAioApi):

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. Ensure a non-empty prompt/messages (or form payload) is passed so input gets populated.
  2. Validate arguments before calling low-level builders: reject empty payloads early with your own error.
  3. Prefer the high-level provider (dashscope_llm) which constructs payloads for you.

Example fix

// before
request = build_api_arequest(model="qwen-max", ..., input=None, form=None)

// after
request = build_api_arequest(model="qwen-max", ..., input={"messages": [{"role":"user","content":"hi"}]}, form=None)
Defensive patterns

Strategy: validation

Validate before calling

def has_payload(input, form) -> bool:
    return input is not None or form is not None

assert has_payload(input, form), "nothing to send: provide input or form"

Try / catch

try:
    request = build_api_arequest(model, input=input, form=form, ...)
except Exception as e:
    if "no input data" in str(e).lower():
        raise ValueError("empty payload; build prompt/messages before calling") from e
    raise

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14). Data as JSON: /api/errors/3c13907dcbd49235. Report an issue: GitHub.