{"record":{"id":"8d79953af7f36656","repo":"t8y2/dbx","slug":"agentsessionid-is-required-8d7995","errorCode":null,"errorMessage":"agentSessionId is required","messagePattern":"agentSessionId is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/main.go","lineNumber":176,"sourceCode":"\t}\n\tif len(req.ID) == 0 {\n\t\treq.ID = json.RawMessage(\"1\")\n\t}\n\tresult, shutdown, err := r.dispatch(req.Method, req.Params)\n\tif err != nil {\n\t\treturn errorResponse(req.ID, req.Method, stringParam(req.Params, \"agentSessionId\"), err), false\n\t}\n\treturn response{JSONRPC: \"2.0\", ID: req.ID, Result: result}, shutdown\n}\n\nfunc (r *runtimeServer) dispatch(method string, params map[string]json.RawMessage) (any, bool, error) {\n\tswitch method {\n\tcase \"handshake\":\n\t\treturn handshakeResult(true), false, nil\n\tcase \"open_session\":\n\t\tid := stringParam(params, \"agentSessionId\")\n\t\tif id == \"\" {\n\t\t\treturn nil, false, errors.New(\"agentSessionId is required\")\n\t\t}\n\t\tvar cp connectParams\n\t\tif err := decodeParams(params, &cp); err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn map[string]bool{\"ok\": true}, false, r.openSession(id, cp)\n\tcase \"close_session\":\n\t\treturn map[string]bool{\"ok\": true}, false, r.closeSession(stringParam(params, \"agentSessionId\"))\n\tcase \"validate_session\":\n\t\tsession, err := r.session(stringParam(params, \"agentSessionId\"))\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\tsession.mu.Lock()\n\t\tdefer session.mu.Unlock()\n\t\treturn map[string]bool{\"ok\": true}, false, session.server.validateConnection()\n\tcase \"cancel_session\":\n\t\tsession, err := r.session(stringParam(params, \"agentSessionId\"))","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/main.go#L158-L194","documentation":"The Cassandra driver agent's dispatch handler requires an agentSessionId parameter for the open_session method. If the params lack a non-empty 'agentSessionId' string, it returns this error instead of opening a session. The ID links subsequent operations to the created gocql session.","triggerScenarios":"Sending a JSON-RPC style request with method 'open_session' whose params object omits agentSessionId or passes an empty string.","commonSituations":"Client SDK version drift where the field was renamed; hand-rolled request payloads in tests or scripts forgetting the field; params serialized with a nil/empty value after failed ID generation upstream.","solutions":["Include a non-empty agentSessionId in the open_session params","Generate the session ID on the client before dispatch (uuid or similar)","Update the client driver to the matching version so it always sends agentSessionId","Add an assertion/log in the client that params contains agentSessionId before dispatch"],"exampleFix":"// before\n// {\"method\":\"open_session\",\"params\":{\"keyspace\":\"ks\"}}\n// after\n// {\"method\":\"open_session\",\"params\":{\"agentSessionId\":\"4f9c...\",\"keyspace\":\"ks\"}}","handlingStrategy":"validation","validationCode":"function assertOpenSessionParams(params) {\n  if (!params || typeof params.agentSessionId !== \"string\" || params.agentSessionId === \"\") {\n    throw new Error(\"open_session requires a non-empty agentSessionId\");\n  }\n}","typeGuard":"function hasAgentSessionId(p) {\n  return typeof p === \"object\" && p !== null &&\n    typeof p.agentSessionId === \"string\" && p.agentSessionId.length > 0;\n}","tryCatchPattern":"try { await rpc(\"open_session\", params) }\ncatch (e) {\n  if (e.message.includes(\"agentSessionId is required\")) {\n    params.agentSessionId = crypto.randomUUID();\n    await rpc(\"open_session\", params);\n  }\n}","preventionTips":["Generate and attach the session ID centrally in the RPC client wrapper","Add a client-side schema check for open_session params","Keep client and agent driver versions in lockstep"],"tags":["rpc","validation","missing-parameter","cassandra","agent"],"backgroundTag":"missing-required-parameter","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}