Skip to content

[Bug]:HTTP 400 "url error, please check url!" when calling qwen4-max with DashScopeChatModel #4347

Closed

Description

@xiaoshuai288

Environment

  • io.agentscope:agentscope:2.0.5
  • Provider: DashScope (native HTTP API)
  • Base URL: https://dashscope.aliyuncs.com
  • JDK 21
  • Model: qwen4-max (fails) / qwen3.8-flash (works, same code, same API key, same base URL)

How I create the model

GenerateOptions options = GenerateOptions.builder()
        .modelName(modelCode)              // "qwen4-max"
        .apiKey(apiKey)
        .baseUrl("https://dashscope.aliyuncs.com")
        .temperature(0.7)
        .build();

ChatModelBase model = DashScopeChatModel.builder()
        .apiKey(apiKey)
        .modelName(modelCode)              // "qwen4-max"
        .baseUrl("https://dashscope.aliyuncs.com")
        .defaultOptions(options)
        .enableThinking(true)
        .build();

ReActAgent agent = ReActAgent.builder()
        .name("llmAnalysis")
        .model(model)
        .sysPrompt("...")
        .build();

Msg msg = agent.call(List.of(userMessage), SomeResult.class, runtimeContext).block();

endpointType is not set, so it defaults to EndpointType.AUTO.

The bug

io.agentscope.core.model.transport.HttpTransportException: [HTTP 400] HTTP request failed with status 400 | id:1
event:error
:HTTP_STATUS/400
data:{"request_id":"74a86b67-62fd-9d9f-b86b-dc50ab0caf0c","code":"InvalidParameter","message":"url error, please check url! For details, see: `https://help.aliyun.com/zh/model-studio/error-code#error-url`"}

Response body: id:1
event:error
:HTTP_STATUS/400
data:{"request_id":"74a86b67-62fd-9d9f-b86b-dc50ab0caf0c","code":"InvalidParameter","message":"url error, please check url! For details, see: `https://help.aliyun.com/zh/model-studio/error-code#error-url`"}

With modelCode = "qwen3.8-flash" and no other change, the same code succeeds.

Activity

  1. added
    bug
    on Nov 23, 2026
  2. iluv7 commented on Nov 23, 2026

    @iluv7
    Contributor

    Figured out the cause: qwen4-max is served by the multimodal API, but AUTO endpoint detection only recognized the qwen3.5–qwen3.8 families. So requests went to the text-generation endpoint, and DashScope answers that mismatch with the 400 url error. That's also why qwen3.8-flash worked with the same code.

    Checked against the live API: qwen4-max returns 400 on the text-generation endpoint and 200 on the multimodal one.

    Added the qwen4 prefix to the detection whitelist in #4348. AUTO now routes qwen4-max to the multimodal endpoint, and both streaming and non-streaming calls work. Until it's released, setting endpointType(EndpointType.MULTIMODAL) (or multimodalModelPatterns(List.of("qwen4"))) works around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions