{"record":{"id":"f2b600ead1e293ae","repo":"redis/jedis","slug":"himport-is-not-supported-on-classname-use-a-sin","errorCode":null,"errorMessage":"HIMPORT is not supported on <ClassName>; use a single-connection pipeline or himportSet on the client","messagePattern":"HIMPORT is not supported on <ClassName>; use a single-connection pipeline or himportSet on the client","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/PipeliningBase.java","lineNumber":935,"sourceCode":"    return appendCommand(commandObjects.httl(key, fields));\n  }\n\n  @Override\n  public Response<List<Long>> hpttl(String key, String... fields) {\n    return appendCommand(commandObjects.hpttl(key, fields));\n  }\n\n  @Override\n  public Response<List<Long>> hpersist(String key, String... fields) {\n    return appendCommand(commandObjects.hpersist(key, fields));\n  }\n\n  // HIMPORT needs a lazily-injected PREPARE on the same physical connection as the SET. That is only\n  // well-defined on a single-connection pipeline (see Pipeline#himportSet); a transaction (MULTI\n  // would desync EXEC) and a cluster pipeline (keyless PREPARE cannot be routed by slot) reject it.\n  @Override\n  public Response<String> himportSet(String key, HashImport fieldset, String... values) {\n    throw himportUnsupported();\n  }\n\n  @Override\n  public Response<String> himportSet(byte[] key, HashImport fieldset, byte[]... values) {\n    throw himportUnsupported();\n  }\n\n  UnsupportedOperationException himportUnsupported() {\n    return new UnsupportedOperationException(\n        \"HIMPORT is not supported on \" + getClass().getSimpleName()\n            + \"; use a single-connection pipeline or himportSet on the client\");\n  }\n\n  @Override\n  public Response<Long> sadd(String key, String... members) {\n    return appendCommand(commandObjects.sadd(key, members));\n  }\n","sourceCodeStart":917,"sourceCodeEnd":953,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/PipeliningBase.java#L917-L953","documentation":"PipeliningBase.himportSet(String, HashImport, String...) throws UnsupportedOperationException because HIMPORT requires a lazily-injected PREPARE command on the same physical connection as the subsequent SET. That guarantee only exists on a single-connection pipeline; on transactions MULTI would desync EXEC, and on cluster pipelines a keyless PREPARE cannot be routed by hash slot. The message names the concrete subclass (e.g. Transaction, ClusterPipeliningBase) so the user knows which pipeline type rejected the call.","triggerScenarios":"Calling himportSet(String key, HashImport fieldset, String... values) on a PipeliningBase subclass that is not a single-connection Pipeline — e.g. inside a MULTI/EXEC transaction (Transaction) or on a cluster pipeline (ClusterPipeliningBase / cluster client pipelining).","commonSituations":"Using redis.clients.jedis.Transaction and expecting hash-import pipelining to work like normal pipelined commands; calling himportSet on a RedisClusterClient pipeline where slot-based routing cannot handle the keyless PREPARE; copy-pasting single-connection pipeline code into a transaction or cluster context; upgrading Jedis and discovering HIMPORT is only available on Pipeline and direct client calls.","solutions":["Use a single-connection Pipeline (obtained from a standalone Jedis/RedisClient connection) instead of a transaction or cluster pipeline when you need pipelined himportSet.","If you are inside a transaction, move the himportSet call outside MULTI/EXEC and issue it directly on the client (client.himportSet(...)).","If you are on a cluster, issue himportSet directly on the RedisClusterClient (which routes the PREPARE+SET pair) rather than through a cluster pipeline.","Replace the HIMPORT usage with regular pipelined hset/hsetex commands if you cannot change pipeline type."],"exampleFix":"// before (transaction — throws)\ntry (Transaction tx = jedis.multi()) {\n  tx.himportSet(\"user:1\", fieldset, \"a\", \"1\", \"b\", \"2\");\n  tx.exec();\n}\n\n// after (single-connection pipeline or direct client call)\nResponse<String> resp;\ntry (Pipeline p = jedis.pipelined()) {\n  resp = p.himportSet(\"user:1\", fieldset, \"a\", \"1\", \"b\", \"2\");\n  p.sync();\n}\n// or simply: jedis.himportSet(\"user:1\", fieldset, \"a\", \"1\", \"b\", \"2\");","handlingStrategy":"try-catch","validationCode":"// Before pipelining, verify the pipeline type supports HIMPORT\nif (!(pipeline instanceof Pipeline) || pipeline instanceof Transaction) {\n    throw new IllegalStateException(\"himportSet requires a single-connection Pipeline; use jedis.pipelined() or call client.himportSet directly\");\n}","typeGuard":"boolean supportsHimport(PipeliningBase p) {\n    return p.getClass().getSimpleName().equals(\"Pipeline\");\n}","tryCatchPattern":"try {\n    response = pipeline.himportSet(key, fieldset, values);\n} catch (UnsupportedOperationException e) {\n    // fall back to direct client call\n    response = new Response<>(BuilderFactory.STRING);\n    client.himportSet(key, fieldset, values);\n}","preventionTips":["Only call himportSet from a Pipeline created via jedis.pipelined() on a standalone connection.","Never call himportSet inside a Transaction (multi/exec) block — move it outside the transaction.","On cluster clients, call himportSet on the client itself, not on a cluster pipeline.","Check the Javadoc/SOURCE comment: HIMPORT is deliberately restricted to single-connection pipelines."],"tags":["java","jedis","unsupported-operation","pipelining","himport","transactions"],"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"}