{"record":{"id":"8f32b712220b7839","repo":"t8y2/dbx","slug":"agentsessionid-is-required-8f32b7","errorCode":null,"errorMessage":"agentSessionId is required","messagePattern":"agentSessionId is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/main.go","lineNumber":182,"sourceCode":"\t}\n\tif len(request.ID) == 0 {\n\t\trequest.ID = json.RawMessage(\"1\")\n\t}\n\tresult, shutdown, err := runtimeServer.dispatch(request.Method, request.Params)\n\tif err != nil {\n\t\treturn errorResponse(request.ID, request.Method, stringParam(request.Params, \"agentSessionId\"), err), false\n\t}\n\treturn response{JSONRPC: \"2.0\", ID: request.ID, Result: result}, shutdown\n}\n\nfunc (runtimeServer *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 connection connectParams\n\t\tif err := decodeParams(params, &connection); err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn map[string]bool{\"ok\": true}, false, runtimeServer.openSession(id, connection)\n\tcase \"close_session\":\n\t\treturn map[string]bool{\"ok\": true}, false, runtimeServer.closeSession(stringParam(params, \"agentSessionId\"))\n\tcase \"validate_session\":\n\t\tsession, err := runtimeServer.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 := runtimeServer.session(stringParam(params, \"agentSessionId\"))","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/main.go#L164-L200","documentation":"The runtime server's dispatch handler requires an agentSessionId parameter for the open_session method; if the string parameter is absent or empty, it rejects the request with this error before decoding connection parameters. Each agent-side session must have a caller-supplied identifier so sessions remain isolated in the runtime server.","triggerScenarios":"Sending a JSON-RPC-style open_session request over the driver's stdin/stdout protocol without params.agentSessionId, or with agentSessionId set to \"\".","commonSituations":"Older client implementations written before agentSessionId was mandated, hand-rolled protocol callers omitting the field, or a client reusing an empty ID after a failed session teardown.","solutions":["Include a non-empty agentSessionId string in the open_session params","Regenerate the agentSessionId per logical session before calling open_session","Update older client code to the current protocol version that mandates agentSessionId","Check the handshake capabilities advertisement to confirm protocol expectations match"],"exampleFix":"// before\n{\"method\":\"open_session\",\"params\":{\"host\":\"hs2:10000\"}}\n// after\n{\"method\":\"open_session\",\"params\":{\"agentSessionId\":\"agent-1\",\"host\":\"hs2:10000\"}}","handlingStrategy":"validation","validationCode":"func validateOpenSession(params map[string]any) error {\n    id, _ := params[\"agentSessionId\"].(string)\n    if strings.TrimSpace(id) == \"\" {\n        return errors.New(\"open_session requires a non-empty agentSessionId\")\n    }\n    return nil\n}\n// run before writing the request to the driver's stdin","typeGuard":null,"tryCatchPattern":"resp, err := callDriver(\"open_session\", params)\nif err != nil && strings.Contains(err.Error(), \"agentSessionId is required\") {\n    return fmt.Errorf(\"client bug: include agentSessionId in open_session params: %w\", err)\n}","preventionTips":["Generate a unique agentSessionId for every logical session before opening","Add a client-side schema check on outgoing protocol messages","Keep client protocol version in sync with the driver's advertised handshake capabilities"],"tags":["protocol","validation","rpc","hive-driver"],"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"}