{"record":{"id":"fe113d9246b1b143","repo":"redis/jedis","slug":"is-not-supported","errorCode":null,"errorMessage":"is not supported.","messagePattern":"is not supported\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/util/JedisCommandIterationBase.java","lineNumber":75,"sourceCode":"    }\n\n    CommandArguments args;\n    if (iterationCompleted) {\n      connection = connections.poll();\n      args = initCommandArguments();\n    } else {\n      args = nextCommandArguments(lastReply);\n    }\n\n    Object rawReply;\n    if (connection.getValue() instanceof Connection) {\n      rawReply = ((Connection) connection.getValue()).executeCommand(args);\n    } else if (connection.getValue() instanceof Pool) {\n      try (Connection c = ((Pool<Connection>) connection.getValue()).getResource()) {\n        rawReply = c.executeCommand(args);\n      }\n    } else {\n      throw new IllegalArgumentException(connection.getValue().getClass() + \"is not supported.\");\n    }\n\n    lastReply = builder.build(rawReply);\n    iterationCompleted = isNodeCompleted(lastReply);\n    if (iterationCompleted) {\n      if (connections.isEmpty()) {\n        roundRobinCompleted = true;\n      }\n    }\n    return lastReply;\n  }\n\n  protected abstract Collection<D> convertBatchToData(B batch);\n\n  public final Collection<D> nextBatchList() {\n    return convertBatchToData(nextBatch());\n  }\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/util/JedisCommandIterationBase.java#L57-L93","documentation":"JedisCommandIterationBase.nextBatch executes a SCAN-family command by obtaining a connection from the iteration's connection holder. If the stored value is neither a Connection nor a Pool (the only two supported types), it throws this IllegalArgumentException naming the offending class. It indicates the iteration object was constructed or reached an unsupported connection type.","triggerScenarios":"Running a scan iteration (e.g. cluster scan helper) whose connection holder value is some object other than Connection or Pool<Connection> — typically after custom construction of the iteration or a library/version change introducing a new connection wrapper type.","commonSituations":"Custom code passing a wrapped or proxied connection into the iteration base; mixing Jedis versions where the wrapper type changed; subclassing the iteration base and supplying a custom connection container.","solutions":["Pass a Connection or a Pool<Connection> (e.g. JedisPool) when constructing/configuring the iteration","Unwrap custom connection wrappers to the underlying Connection before iterating","Upgrade Jedis so the iteration base recognizes the connection type used by your client version","If subclassing, override the connection-execution path instead of feeding unsupported types"],"exampleFix":"// before\niteration.addConnection(new MyConnectionWrapper(pool));\n// after\ntry (Connection c = pool.getResource()) {\n  iteration.addConnection(c);\n}","handlingStrategy":"validation","validationCode":"Object v = connection.getValue();\nif (!(v instanceof Connection) && !(v instanceof Pool)) {\n  throw new IllegalStateException(\"Iteration requires Connection or Pool, got \" + v.getClass());\n}","typeGuard":"boolean isSupportedConnectionHolder(Object v) { return v instanceof Connection || v instanceof Pool; }","tryCatchPattern":"try {\n  iteration.nextBatch();\n} catch (IllegalArgumentException e) {\n  // rebuild iteration with a Connection or Pool<Connection>\n}","preventionTips":["Only supply Connection or Pool<Connection> to scan iterations","Unwrap proxied/wrapped connections before iterating","Keep Jedis versions consistent across modules","Verify connection holder types when subclassing iteration helpers"],"tags":["java","illegal-argument","scan-iteration","connection"],"backgroundTag":"unsupported-operation","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}