{"record":{"id":"5189410729382d8d","repo":"FoundationAgents/MetaGPT","slug":"unsupported-protocol-s-support-http-https-we","errorCode":null,"errorMessage":"Unsupported protocol: %s, support [http, https, websocket]","messagePattern":"Unsupported protocol: (.+?), support \\[http, https, websocket\\]","errorType":"validation","errorClass":"UnsupportedApiProtocol","httpStatus":null,"severity":"error","filePath":"metagpt/provider/dashscope_api.py","lineNumber":83,"sourceCode":"\n        if task_group:\n            http_url += \"%s/\" % task_group\n        if task:\n            http_url += \"%s/\" % task\n        if function:\n            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)","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/provider/dashscope_api.py#L65-L101","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nrequest = build_api_arequest(..., api_protocol=\"grpc\")  # UnsupportedApiProtocol\n\n# after\nrequest = build_api_arequest(..., api_protocol=\"https\")","handlingStrategy":"validation","validationCode":"ALLOWED = {\"http\", \"https\", \"websocket\"}\n\ndef protocol_ok(api_protocol) -> bool:\n    return api_protocol in ALLOWED\n\nassert protocol_ok(cfg.get(\"api_protocol\", \"https\"))","typeGuard":"def is_supported_protocol(p: object) -> bool:\n    return isinstance(p, str) and p in {\"http\", \"https\", \"websocket\"}","tryCatchPattern":"try:\n    request = build_api_arequest(..., api_protocol=proto)\nexcept Exception as e:\n    if \"Unsupported protocol\" in str(e):\n        raise ValueError(f\"use one of http/https/websocket, got {proto!r}\") from e\n    raise","preventionTips":["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."],"tags":["dashscope","protocol","validation","vendor-code"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}