{"record":{"id":"580d902c6b366b88","repo":"redisson/redisson","slug":"should-be-defined-through-redisson-config-object","errorCode":null,"errorMessage":"Should be defined through Redisson Config object","messagePattern":"Should be defined through Redisson Config object","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"redisson-spring/redisson-spring-data/redisson-spring-data-16/src/main/java/org/redisson/spring/data/connection/RedissonConnection.java","lineNumber":1704,"sourceCode":"    public void resetConfigStats() {\n        write(null, StringCodec.INSTANCE, RedisCommands.CONFIG_RESETSTAT);\n    }\n\n    private static final RedisStrictCommand<Long> TIME = new RedisStrictCommand<Long>(\"TIME\", new TimeLongObjectDecoder());\n    \n    @Override\n    public Long time() {\n        return read(null, LongCodec.INSTANCE, TIME);\n    }\n\n    @Override\n    public void killClient(String host, int port) {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void setClientName(byte[] name) {\n        throw new UnsupportedOperationException(\"Should be defined through Redisson Config object\");\n    }\n\n    @Override\n    public String getClientName() {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public List<RedisClientInfo> getClientList() {\n        return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);\n    }\n\n    @Override\n    public void slaveOf(String host, int port) {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override","sourceCodeStart":1686,"sourceCodeEnd":1722,"githubUrl":"https://github.com/redisson/redisson/blob/91188987c2a9023e7fedabff758681ad9b107f25/redisson-spring/redisson-spring-data/redisson-spring-data-16/src/main/java/org/redisson/spring/data/connection/RedissonConnection.java#L1686-L1722","documentation":"RedissonConnection.setClientName() deliberately throws UnsupportedOperationException with the message 'Should be defined through Redisson Config object'. Redisson establishes and pools its connections through its own Config, so the Spring Data CLIENT SETNAME call cannot meaningfully reach the connections actually in use; the client name must be set in Redisson's configuration instead.","triggerScenarios":"Calling connection.setClientName(name) (e.g. RedisTemplate.execute with conn.setClientName, or library/tooling that sets client names for diagnostics) on the redisson-spring-data connection adapter.","commonSituations":"Application monitoring/audit tooling that tags every Redis connection with a client name; code migrated from Jedis/Lettuce Spring Data adapters where setClientName works; attempting to identify app connections in CLIENT LIST output.","solutions":["Set the name in Redisson's Config: config.useSingleServer().setClientName(\"my-app\") (or the equivalent for cluster/sentinel config)","Remove the setClientName call from Spring Data code paths when using the Redisson adapter","For per-instance identification, use the Redisson-assigned client names visible in CLIENT LIST after configuring Config.clientName"],"exampleFix":"// before\nredisTemplate.execute((RedisCallback<Object>) conn -> {\n    conn.setClientName(\"my-app\".getBytes()); // throws\n    return null;\n});\n\n// after\nConfig config = new Config();\nconfig.useSingleServer()\n      .setAddress(\"redis://localhost:6379\")\n      .setClientName(\"my-app\");\nRedisson.create(config);","handlingStrategy":"type-guard","validationCode":"// capability check before calling\ntry {\n    conn.setClientName(name); // will throw on Redisson adapter\n} catch (UnsupportedOperationException e) { /* expected on Redisson */ }","typeGuard":"boolean supportsSetClientName(RedisConnectionFactory f) {\n    return !(f instanceof RedissonConnectionFactory);\n}","tryCatchPattern":"try {\n    connection.setClientName(name.getBytes());\n} catch (UnsupportedOperationException e) {\n    log.debug(\"client name managed via Redisson Config; skipping\");\n}","preventionTips":["Set clientName in Redisson Config (useSingleServer().setClientName(...)) at client creation","Make diagnostic tooling tolerate adapters that reject setClientName","Centralize client identification in configuration, not runtime calls"],"tags":["spring-data-redis","client-name","unsupported-operation","redisson"],"backgroundTag":null,"analyzedSha":"91188987c2a9023e7fedabff758681ad9b107f25","analyzedAt":"2026-08-14T11:39:42.619Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}