Skip to content

Error handling notification: Could not resolve type id 'config_option_update' as a subtype #4

@cmoulliard

Description

@cmoulliard

Issue / Question

How can a user figure out why they are getting such an error when the model is specified on the ACP client ?

[FirstContact.main()] INFO com.agentclientprotocol.sdk.client.transport.StdioAcpClientTransport - ACP agent starting.
[FirstContact.main()] INFO com.agentclientprotocol.sdk.client.transport.StdioAcpClientTransport - ACP agent started
Connected to agent!
Agent capabilities: AgentCapabilities[loadSession=true, mcpCapabilities=McpCapabilities[http=true, sse=true], promptCapabilities=PromptCapabilities[audio=null, embeddedContext=true, image=true], meta=null]
Session created: ses_1c4eaeddfffe0FvsrWE9cbDz1G
[acp-client-inbound] ERROR com.agentclientprotocol.sdk.spec.AcpClientSession - Error handling notification: Could not resolve type id 'config_option_update' as a subtype of `com.agentclientprotocol.sdk.spec.AcpSchema$SessionUpdate`: known type ids = [agent_message_chunk, agent_thought_chunk, available_commands_update, current_mode_update, plan, tool_call, tool_call_update, usage_update, user_message_chunk] (for POJO property 'update')
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.agentclientprotocol.sdk.spec.AcpSchema$SessionNotification["update"])

Success! Stop reason: END_TURN

Code used

The following example is working fine using opencode acp" but raise the error reported when we set the model client.setSessionModel(modelId);

/*
 * Module: First Contact
 *
 * Your first ACP client - connect to Opencode CLI and get a response.
 *
 * This module demonstrates the minimal code needed to:
 * 1. Create a transport to communicate with an ACP agent
 * 2. Build a client
 * 3. Initialize the connection
 * 4. Create a session
 * 5. Send a prompt and receive a response
 *
 * Prerequisites:
 * - Opencode CLI installed
 * - GCloud Vertex AI: project, location and credientials
 * - ACP Java SDK on classpath
 */

import java.util.List;

import com.agentclientprotocol.sdk.client.AcpClient;
import com.agentclientprotocol.sdk.client.AcpSyncClient;
import com.agentclientprotocol.sdk.client.transport.AgentParameters;
import com.agentclientprotocol.sdk.client.transport.StdioAcpClientTransport;
import com.agentclientprotocol.sdk.spec.AcpSchema;
import com.agentclientprotocol.sdk.spec.AcpSchema.AgentMessageChunk;
import com.agentclientprotocol.sdk.spec.AcpSchema.NewSessionRequest;
import com.agentclientprotocol.sdk.spec.AcpSchema.PromptRequest;
import com.agentclientprotocol.sdk.spec.AcpSchema.TextContent;

public class FirstContact {

    public static void main(String[] args) {
        // Check for required API key before starting
        checkAIApiKey();

        // 1. Configure agent process - tells the transport how to launch the agent
        var params = AgentParameters.builder("opencode")
                .arg("acp")
                .build();

        // 2. Create transport (launches subprocess when client connects)
        var transport = new StdioAcpClientTransport(params);

        // 3. Build sync client with an update consumer that prints the agent's response
        try (AcpSyncClient client = AcpClient.sync(transport)
                .sessionUpdateConsumer(notification -> {
                    if (notification.update() instanceof AgentMessageChunk msg) {
                        System.out.print(((TextContent) msg.content()).text());
                    }
                })
                .build()) {

            // 4. Initialize - handshake with the agent
            var initResponse = client.initialize();
            System.out.println("Connected to agent!");
            System.out.println("Agent capabilities: " + initResponse.agentCapabilities());

            // 5. Create a session - workspace context for conversation
            var s = client.newSession(
                    new NewSessionRequest(".", List.of()));
            System.out.println("Session created: " + s.sessionId());

            var modelId = new AcpSchema.SetSessionModelRequest(s.sessionId(),
                    "google-vertex-anthropic/claude-sonnet-4-6@default");
            client.setSessionModel(modelId); // THAT FAILS HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            // 6. Send a prompt - the magic moment!
            var response = client
                    .prompt(new PromptRequest(s.sessionId(),
                            List.of(new TextContent("What is 2+2? Reply with just the number."))));

            // 7. Done! Print the result
            System.out.println("\nSuccess! Stop reason: " + response.stopReason());
            System.out.println("\nMeta data: " + response.meta());

        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
            e.printStackTrace();
        }
    }

    /**
     * Verify AI_API_KEY is set before attempting to connect.
     */
    private static void checkAIApiKey() {

        String apiKey = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
        String location = System.getenv("VERTEX_LOCATION");
        String project = System.getenv("GOOGLE_CLOUD_PROJECT");

        if (apiKey == null || apiKey.isBlank()) {
            System.err.println("""
                    ERROR: GOOGLE_APPLICATION_CREDENTIALS environment variable is not set.
                    """);
            System.exit(1);
        }

        if (location == null || location.isBlank()) {
            System.err.println("""
                    ERROR: VERTEX_LOCATION environment variable is not set.
                    """);
            System.exit(1);
        }

        if (project == null || project.isBlank()) {
            System.err.println("""
                    ERROR: GOOGLE_CLOUD_PROJECT environment variable is not set.
                    """);
            System.exit(1);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions