{"record":{"id":"eb3e52b1d723828d","repo":"aeron-io/aeron","slug":"clientname-length-must-max-client-name-length","errorCode":null,"errorMessage":"clientName length must <= <MAX_CLIENT_NAME_LENGTH>","messagePattern":"clientName length must <= <MAX_CLIENT_NAME_LENGTH>","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/Aeron.java","lineNumber":1198,"sourceCode":"                clientLock = new ReentrantLock();\n            }\n            else if (clientLock instanceof NoOpLock && !useConductorAgentInvoker)\n            {\n                throw new ConfigurationException(\n                    \"Must use Aeron.Context.useConductorAgentInvoker(true) when Aeron.Context.clientLock(...) \" +\n                    \"is using a NoOpLock\");\n            }\n\n            if (null != driverAgentInvoker && !useConductorAgentInvoker)\n            {\n                throw new ConfigurationException(\n                    \"Must use Aeron.Context.useConductorAgentInvoker(true) when Aeron.Context.driverAgentInvoker() \" +\n                    \"is set\");\n            }\n\n            if (clientName.length() > MAX_CLIENT_NAME_LENGTH)\n            {\n                throw new ConfigurationException(\"clientName length must <= \" + MAX_CLIENT_NAME_LENGTH);\n            }\n\n            if (null == epochClock)\n            {\n                epochClock = SystemEpochClock.INSTANCE;\n            }\n\n            if (null == nanoClock)\n            {\n                nanoClock = SystemNanoClock.INSTANCE;\n            }\n\n            if (idleSleepDurationNs < 0 || idleSleepDurationNs > TimeUnit.SECONDS.toNanos(1))\n            {\n                throw new ConfigurationException(\"Invalid idle sleep duration: \" + idleSleepDurationNs + \"ns\");\n            }\n\n            if (null == idleStrategy)","sourceCodeStart":1180,"sourceCodeEnd":1216,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/Aeron.java#L1180-L1216","documentation":"Aeron.Context throws this ConfigurationException when the configured clientName exceeds MAX_CLIENT_NAME_LENGTH. The client name is sent to the media driver and recorded (e.g. in the C' file), so it is bounded; an over-long name is treated as a configuration error at connect time.","triggerScenarios":"Calling ctx.clientName(name) with a string whose length() is greater than Aeron.Context.MAX_CLIENT_NAME_LENGTH (effectively 100, being MAX_HOST_NAME_LEN 255-derived — check the constant; the message embeds the actual limit), then Aeron.connect(ctx).","commonSituations":"Generating client names from host+process+timestamp concatenations that exceed the limit; embedding long job IDs or URIs into the client name; configurations built for other systems with looser name limits.","solutions":["Truncate or hash the client name so its length is <= MAX_CLIENT_NAME_LENGTH before calling ctx.clientName(...)","Use a compact unique identifier (e.g. UUID prefix or hash of the long name)","Validate the name length at startup and fail fast with your own clearer message"],"exampleFix":"// before\nctx.clientName(host + \"-\" + longJobId + \"-\" + region); // may exceed limit\n// after\nString name = host + \"-\" + Integer.toHexString(longJobId.hashCode());\nif (name.length() > Aeron.Context.MAX_CLIENT_NAME_LENGTH) {\n    name = name.substring(0, Aeron.Context.MAX_CLIENT_NAME_LENGTH);\n}\nctx.clientName(name);","handlingStrategy":"validation","validationCode":"if (name.length() > Aeron.Context.MAX_CLIENT_NAME_LENGTH) { name = name.substring(0, Aeron.Context.MAX_CLIENT_NAME_LENGTH); }","typeGuard":"String safeClientName(String s) { return s == null ? s : (s.length() <= Aeron.Context.MAX_CLIENT_NAME_LENGTH ? s : s.substring(0, Aeron.Context.MAX_CLIENT_NAME_LENGTH)); }","tryCatchPattern":"try { ctx.clientName(name); } catch (ConfigurationException e) { if (e.getMessage().startsWith(\"clientName length\")) { ctx.clientName(safeClientName(name)); } else throw e; }","preventionTips":["Validate client name length at config load time","Build names from bounded components (hash long ids)","Log the effective limit from MAX_CLIENT_NAME_LENGTH instead of hardcoding"],"tags":["configuration","client-name","length-limit","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}