{"record":{"id":"10bac89316cfadf5","repo":"t8y2/dbx","slug":"agentsessionid-is-required","errorCode":null,"errorMessage":"agentSessionId is required","messagePattern":"agentSessionId is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/common/src/main/java/com/dbx/agent/MultiSessionJsonRpcServer.java","lineNumber":372,"sourceCode":"        private final int maximumRequestThreads;\n        private final int maximumCleanupThreads;\n\n        RuntimeLimits(int maximumRequestThreads, int maximumCleanupThreads) {\n            if (maximumRequestThreads <= 0 || maximumCleanupThreads <= 0) {\n                throw new IllegalArgumentException(\"Agent runtime thread limits must be positive\");\n            }\n            this.maximumRequestThreads = maximumRequestThreads;\n            this.maximumCleanupThreads = maximumCleanupThreads;\n        }\n\n        private static RuntimeLimits defaults() {\n            return new RuntimeLimits(MAX_REQUEST_THREADS, MAX_CLEANUP_THREADS);\n        }\n    }\n\n    private static String requiredSessionId(JsonObject params) {\n        if (!params.has(\"agentSessionId\") || params.get(\"agentSessionId\").getAsString().trim().isEmpty()) {\n            throw new IllegalArgumentException(\"agentSessionId is required\");\n        }\n        return params.get(\"agentSessionId\").getAsString();\n    }\n\n    private void writeResponse(JsonObject response) {\n        synchronized (outputLock) {\n            protocolOutput.println(gson.toJson(response));\n            protocolOutput.flush();\n        }\n    }\n\n    private static final class Session {\n        private final JsonRpcServer server;\n        private final SessionRpcHandler handler;\n        private final ReentrantLock lock = new ReentrantLock();\n        private final AtomicReference<State> state = new AtomicReference<>(State.ACTIVE);\n        private final AtomicBoolean cleanupScheduled = new AtomicBoolean();\n","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/common/src/main/java/com/dbx/agent/MultiSessionJsonRpcServer.java#L354-L390","documentation":"requiredSessionId extracts agentSessionId from the request params and throws IllegalArgumentException if the field is absent or blank (after trim). Multi-session requests are mandatory-scoped to a session, so a missing ID cannot be routed.","triggerScenarios":"Any multi-session JSON-RPC request whose params omit agentSessionId or pass whitespace/empty string; clients built for single-session mode not sending the field after switching to the multi-session server.","commonSituations":"Older client versions predating multi-session support; params assembled incorrectly (field name typo like sessionId); null/empty values serialized by generic JSON builders.","solutions":["Include a non-blank agentSessionId in every request's params object","Fix the field name to exactly agentSessionId in the client payload","Open a session first and thread its ID through all subsequent calls","Client-side: validate the params object before sending"],"exampleFix":"// before\nparams.addProperty(\"sessionId\", id);\n// after\nparams.addProperty(\"agentSessionId\", id); // correct key, non-blank","handlingStrategy":"validation","validationCode":"if (!params.has(\"agentSessionId\") || params.get(\"agentSessionId\").getAsString().isBlank()) {\n    throw new IllegalArgumentException(\"agentSessionId must be set before calling the server\");\n}","typeGuard":"boolean hasSessionId(JsonObject p) {\n    return p != null && p.has(\"agentSessionId\") && !p.get(\"agentSessionId\").getAsString().trim().isEmpty();\n}","tryCatchPattern":null,"preventionTips":["Build request params through a helper that always injects agentSessionId","Use the exact field name agentSessionId in all clients","Open a session before any request and store its ID centrally","Add client-side serialization tests asserting the field is present"],"tags":["jsonrpc","params-validation","session-management","illegal-argument"],"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"}