Bug Description
ACP session initialization fails when using third-party models like DashScope (bailian) via ANTHROPIC_BASE_URL. The SDK Zod schema validation throws Invalid input: expected object, received undefined during session initialization.
Steps to Reproduce
- Set environment variables for DashScope:
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://coding.dashscope.aliyuncs.com/apps/anthropic/v1"
- Run:
acpx claude exec "echo hello"
- Error occurs during session initialization
Expected Behavior
The ACP agent should work with any Anthropic-compatible API provider, including DashScope/bailian models (qwen3.5-plus, glm-5, kimi-k2.5, etc.).
Actual Error
Invalid input: expected object, received undefined
{
sessionUpdate: { _errors: [Array] },
title: { _errors: [Array] },
toolCallId: { _errors: [Array] },
entries: { _errors: [Array] },
availableCommands: { _errors: [Array] },
currentModeId: { _errors: [Array] },
configOptions: { _errors: [Array] },
used: { _errors: [Array] }
}
The error repeats many times in a loop during SDK initialization.
Environment
@agentclientprotocol/claude-agent-acp: 0.24.2
@agentclientprotocol/sdk: 0.17.0
@anthropic-ai/claude-agent-sdk: 0.2.84
- Node.js: v22.22.1
- OS: Linux (WSL)
- acpx: 0.3.1
Additional Context
The old package @zed-industries/claude-agent-acp (v0.23.1) had Bailian/DashScope workaround code in getAvailableModels() with a BAILIAN_MODELS array. This code is no longer present in the new @agentclientprotocol package. When ANTHROPIC_BASE_URL contains dashscope, isBailian was previously set to true to handle DashScope-specific model behavior. The new package removed this workaround, causing initialization to go through the standard (Anthropic-only) code path which expects fields that DashScope responses do not provide.
Possible Fix
- Restore the Bailian/DashScope detection and workaround code in
getAvailableModels()
- Or add a more robust error handling layer that gracefully handles missing/undefined fields in ACP messages for non-Anthropic providers
- Or document officially supported providers and ensure compatibility
Bug Description
ACP session initialization fails when using third-party models like DashScope (bailian) via
ANTHROPIC_BASE_URL. The SDK Zod schema validation throwsInvalid input: expected object, received undefinedduring session initialization.Steps to Reproduce
acpx claude exec "echo hello"Expected Behavior
The ACP agent should work with any Anthropic-compatible API provider, including DashScope/bailian models (qwen3.5-plus, glm-5, kimi-k2.5, etc.).
Actual Error
The error repeats many times in a loop during SDK initialization.
Environment
@agentclientprotocol/claude-agent-acp: 0.24.2@agentclientprotocol/sdk: 0.17.0@anthropic-ai/claude-agent-sdk: 0.2.84Additional Context
The old package
@zed-industries/claude-agent-acp(v0.23.1) had Bailian/DashScope workaround code ingetAvailableModels()with aBAILIAN_MODELSarray. This code is no longer present in the new@agentclientprotocolpackage. WhenANTHROPIC_BASE_URLcontainsdashscope,isBailianwas previously set totrueto handle DashScope-specific model behavior. The new package removed this workaround, causing initialization to go through the standard (Anthropic-only) code path which expects fields that DashScope responses do not provide.Possible Fix
getAvailableModels()