{"record":{"id":"eb65a132d1f49884","repo":"t8y2/dbx","slug":"agentsessionid-is-required-eb65a1","errorCode":null,"errorMessage":"agentSessionId is required","messagePattern":"agentSessionId is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/kingbase-go/main.go","lineNumber":233,"sourceCode":"\t\treturn errorResponse(req.ID, 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 map[string]any{\n\t\t\t\"protocolVersion\":      protocolVersion,\n\t\t\t\"agentProtocolVersion\": protocolVersion,\n\t\t\t\"capabilities\": []string{\n\t\t\t\t\"connect\", \"test_connection\", \"metadata\", \"query\", \"paged_query\", \"transaction\", \"ddl\", \"multi_session\",\n\t\t\t},\n\t\t}, 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":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/kingbase-go/main.go#L215-L251","documentation":"The open_session RPC requires an agentSessionId parameter to tag the new session; an empty value is rejected before decoding the connection params. Every subsequent session-scoped call is routed by this id, so it must be supplied.","triggerScenarios":"Calling the 'open_session' RPC without agentSessionId, or with an empty/whitespace stringParam result.","commonSituations":"A client wrapper forgot to generate or pass a session id; a multi-session tool reused a code path from single-session mode that never sets agentSessionId; params serialization dropped the field.","solutions":["Generate and include a unique non-empty agentSessionId (e.g. a UUID) in the open_session params","Check the client wrapper so session-opening calls always populate agentSessionId","If only a single connection is needed, use the 'connect' RPC instead of open_session"],"exampleFix":"// before\nr.call(\"open_session\", map[string]any{\"host\": host})\n// after\nr.call(\"open_session\", map[string]any{\"agentSessionId\": uuid.NewString(), \"host\": host})","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(sessionID) == \"\" { return errors.New(\"generate an agentSessionId before calling open_session\") }","typeGuard":null,"tryCatchPattern":"resp, err := r.call(\"open_session\", params); if err != nil && strings.Contains(err.Error(), \"agentSessionId is required\") { /* fix client param construction */ }","preventionTips":["Generate a UUID session id in the client wrapper so callers cannot omit it","Use 'connect' for single-connection scenarios instead of open_session","Cover the session-open path with an integration test asserting a non-empty agentSessionId"],"tags":["validation","session","parameters"],"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"}