t8y2/dbx · error
agentSessionId is required
Error message
agentSessionId is required
What it means
The vastbase-go driver's open_session operation creates a named session keyed by agentSessionId. This identifier is required to route subsequent operations (query, transaction, etc.) to that session, so the driver throws when it is missing or empty.
Source
Thrown at agents/drivers/vastbase-go/main.go:240
return errorResponse(req.ID, req.Method, stringParam(req.Params, "agentSessionId"), err), false
}
return response{JSONRPC: "2.0", ID: req.ID, Result: result}, shutdown
}
func (r *runtimeServer) dispatch(method string, params map[string]json.RawMessage) (any, bool, error) {
switch method {
case "handshake":
return map[string]any{
"protocolVersion": protocolVersion,
"agentProtocolVersion": protocolVersion,
"capabilities": []string{
"connect", "test_connection", "metadata", "query", "paged_query", "transaction", "ddl", "multi_session", "structured_error_v1",
},
}, false, nil
case "open_session":
id := stringParam(params, "agentSessionId")
if id == "" {
return nil, false, errors.New("agentSessionId is required")
}
var cp connectParams
if err := decodeParams(params, &cp); err != nil {
return nil, false, err
}
return map[string]bool{"ok": true}, false, r.openSession(id, cp)
case "close_session":
return map[string]bool{"ok": true}, false, r.closeSession(stringParam(params, "agentSessionId"))
case "validate_session":
session, err := r.session(stringParam(params, "agentSessionId"))
if err != nil {
return nil, false, err
}
session.mu.Lock()
defer session.mu.Unlock()
release, permitErr := session.server.acquireOperationPermit("validate_session")
if permitErr != nil {
return nil, false, permitErrView on GitHub (pinned to c0390bff16)
Solutions
- Generate and pass a non-empty agentSessionId, e.g. a UUID
- Reuse the same agentSessionId in later operations targeting the session
- Validate the id before dispatching open_session
Example fix
// before
{ "op": "open_session", "connect": { "dsn": "vb://localhost/db" } }
// after
{ "op": "open_session", "agentSessionId": "sess-1", "connect": { "dsn": "vb://localhost/db" } } Defensive patterns
Strategy: validation
Validate before calling
const id = String(crypto.randomUUID());
if (!id) throw new Error("agentSessionId is required");
await agent.dispatch("open_session", { agentSessionId: id, ...connectParams }); Type guard
function hasSessionId(p) { return typeof p.agentSessionId === "string" && p.agentSessionId.trim().length > 0; } Try / catch
try { await agent.dispatch("open_session", params); } catch (e) { if (/agentSessionId is required/.test(e.message)) { params.agentSessionId = crypto.randomUUID(); await agent.dispatch("open_session", params); } else throw e; } Prevention
- Generate a session id before open_session and store it
- Reuse the same id for session-scoped operations
- Validate required keys in a dispatch wrapper
When it happens
Trigger: Dispatching open_session without agentSessionId, or with agentSessionId:""; constructing params programmatically where the id variable was empty.
Common situations: Forgetting the session id when switching from simple query ops to multi-session usage; string interpolation of an unset variable; orchestrators generating session ids that end up empty on first run.
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
- agentSessionId is required
- Cassandra connection runtime is closed
- Not connected
- agentSessionId is required
- agentSessionId is required
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/c4539e0e40f6462f.
Report an issue: GitHub.