t8y2/dbx · error

agentSessionId is required

Error message

agentSessionId is required

What it means

dispatch requires every open_session JSON-RPC request to include a non-empty agentSessionId string parameter. This identifier is what scopes and isolates the session created by runtimeServer.openSession. If the parameter is missing or an empty string, the request is rejected before any session state is created, because a session without an ID cannot be addressed or kept isolated from others.

Source

Thrown at agents/drivers/argo-go/main.go:182

	}
	if len(request.ID) == 0 {
		request.ID = json.RawMessage("1")
	}
	result, shutdown, err := runtimeServer.dispatch(request.Method, request.Params)
	if err != nil {
		return errorResponse(request.ID, request.Method, stringParam(request.Params, "agentSessionId"), err), false
	}
	return response{JSONRPC: "2.0", ID: request.ID, Result: result}, shutdown
}

func (runtimeServer *runtimeServer) dispatch(method string, params map[string]json.RawMessage) (any, bool, error) {
	switch method {
	case "handshake":
		return handshakeResult(true), false, nil
	case "open_session":
		id := stringParam(params, "agentSessionId")
		if id == "" {
			return nil, false, errors.New("agentSessionId is required")
		}
		var connection connectParams
		if err := decodeParams(params, &connection); err != nil {
			return nil, false, err
		}
		return map[string]bool{"ok": true}, false, runtimeServer.openSession(id, connection)
	case "close_session":
		return map[string]bool{"ok": true}, false, runtimeServer.closeSession(stringParam(params, "agentSessionId"))
	case "validate_session":
		session, err := runtimeServer.session(stringParam(params, "agentSessionId"))
		if err != nil {
			return nil, false, err
		}
		session.mu.Lock()
		defer session.mu.Unlock()
		return map[string]bool{"ok": true}, false, session.server.validateConnection()
	case "cancel_session":
		session, err := runtimeServer.session(stringParam(params, "agentSessionId"))

View on GitHub (pinned to c0390bff16)

Solutions

  1. Add agentSessionId with a non-empty unique string to the open_session request params
  2. Ensure your JSON serializer does not omit empty-string fields (or send a real generated ID instead of empty)
  3. Upgrade/regenerate the client so it matches the current protocol handshake spec
  4. Log the outgoing params object and confirm agentSessionId survives any proxy/middleware transformation

Example fix

// before
{"method": "open_session", "params": {"connect": {"host": "localhost"}}}
// after
{"method": "open_session", "params": {"agentSessionId": "sess-9f3a2c", "connect": {"host": "localhost"}}}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(params["agentSessionId"]) == "" {
    return errors.New("agentSessionId is required")
}

Try / catch

result, err := dispatch(method, params)
if err != nil && err.Error() == "agentSessionId is required" {
    // fix request params and retry with generated ID
}

Prevention

When it happens

Trigger: Sending an open_session request whose params object omits agentSessionId, or passes it as an empty string (""). Raised directly in dispatch before decodeParams/connectParams are even processed.

Common situations: A client generated the request envelope manually and forgot the field; a serialization layer dropped empty-string fields; an older client version predating the agentSessionId requirement; a proxy or middleware rewrote params and lost the field.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/6df3b8a2f4c714cc. Report an issue: GitHub.