FoundationAgents/MetaGPT · error · UnsupportedApiProtocol
Unsupported protocol: %s, support [http, https, websocket]
Error message
Unsupported protocol: %s, support [http, https, websocket]
What it means
This is vendored DashScope SDK request-building code: build_api_arequest dispatches on api_protocol and only knows 'http', 'https', and 'websocket'. Any other value raises UnsupportedApiProtocol with the offending protocol interpolated. In MetaGPT it surfaces when the dashscope provider is configured with a nonstandard protocol.
Source
Thrown at metagpt/provider/dashscope_api.py:83
if task_group:
http_url += "%s/" % task_group
if task:
http_url += "%s/" % task
if function:
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)View on GitHub (pinned to 11cdf466d0)
Solutions
- Use api_protocol 'http', 'https' or 'websocket' — for standard DashScope generation calls prefer the https path (default).
- Remove/leave unset any protocol override in config so the default is used.
- Do not call these internal vendored functions directly; go through the MetaGPT dashscope LLM provider.
Example fix
# before request = build_api_arequest(..., api_protocol="grpc") # UnsupportedApiProtocol # after request = build_api_arequest(..., api_protocol="https")
Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = {"http", "https", "websocket"}
def protocol_ok(api_protocol) -> bool:
return api_protocol in ALLOWED
assert protocol_ok(cfg.get("api_protocol", "https")) Type guard
def is_supported_protocol(p: object) -> bool:
return isinstance(p, str) and p in {"http", "https", "websocket"} Try / catch
try:
request = build_api_arequest(..., api_protocol=proto)
except Exception as e:
if "Unsupported protocol" in str(e):
raise ValueError(f"use one of http/https/websocket, got {proto!r}") from e
raise Prevention
- Do not override api_protocol unless you know the vendored SDK supports it.
- Keep protocol config values constrained to the allowed set in your own settings schema.
When it happens
Trigger: Calling the vendored aigc/_build request path with api_protocol='grpc' or any string other than http/https/websocket; passing a protocol value from config unvalidated.
Common situations: Copied dashscope code paths invoked directly with custom parameters; configuration drift where a protocol field is set to a placeholder like 'default' or 'tcp'; using newer DashScope features not supported by this vendored copy.
Related errors
- There is no input data and form data
- prompt or messages is required!
- Model is required!
- Only support for python, markdown, but got {language}
- Only support for language: python, markdown, but got {langua
AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14).
Data as JSON: /api/errors/5189410729382d8d.
Report an issue: GitHub.