{"record":{"id":"40dffaf8e96c3257","repo":"t8y2/dbx","slug":"agentsessionid-is-required-40dffa","errorCode":null,"errorMessage":"agentSessionId is required","messagePattern":"agentSessionId is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/neo4j-go/main.go","lineNumber":204,"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(), 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, r.openSession(id, connection)\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":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/neo4j-go/main.go#L186-L222","documentation":"The Neo4j driver agent's dispatch handles the open_session JSON-RPC method. Multi-session protocol requires each session to be keyed by an agentSessionId; if the params omit it or it is an empty string, dispatch rejects the call before creating a session.","triggerScenarios":"Sending an open_session request whose params lack the agentSessionId field, or pass agentSessionId: \"\".","commonSituations":"Client SDK version predating the multi-session protocol (pre-agentSessionId), hand-rolled JSON payloads missing the field, serialization dropping empty strings via omitempty on the caller side.","solutions":["Include a non-empty agentSessionId (e.g. a UUID) in the open_session params.","Upgrade the client library to one speaking the multi-session protocol version.","Log the outgoing params JSON to confirm the field name and value; watch for omitempty stripping it."],"exampleFix":"// before\nparams := map[string]any{\"uri\": uri} // missing agentSessionId\n// after\nparams := map[string]any{\"agentSessionId\": sessionId, \"uri\": uri}","handlingStrategy":"validation","validationCode":"if sessionID == \"\" {\n    return errors.New(\"cannot open_session: agentSessionId is empty\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := dispatch(\"open_session\", params); err != nil {\n    if strings.Contains(err.Error(), \"agentSessionId is required\") {\n        return fmt.Errorf(\"client bug: generate a session id before open_session: %w\", err)\n    }\n    return err\n}","preventionTips":["Generate a UUID session ID client-side before every open_session","Check for empty-string stripping via omitempty in your JSON marshaling","Upgrade clients to the multi-session protocol version"],"tags":["neo4j","rpc","protocol","session"],"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-14T00:17:10.932Z"}