{"record":{"id":"49187dde2a759fae","repo":"redis/jedis","slug":"moving-target-must-be-a-host-port-byte-at-index","errorCode":null,"errorMessage":"MOVING target must be a host:port byte[] at index ","messagePattern":"MOVING target must be a host:port byte\\[\\] at index ","errorType":"exception","errorClass":"MalformedMaintenanceEventException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/MaintenancePushCodec.java","lineNumber":117,"sourceCode":"    return new MigratedEvent((Long) c.get(1), shardIds(c, 2));\n  }\n\n  private static MaintenanceEvent failedOver(List<Object> c) { // [FAILED_OVER, seq, shards]\n    if (c.size() < 3 || !(c.get(1) instanceof Long) || !(c.get(2) instanceof byte[])) {\n      throw malformed(\"FAILED_OVER\", c);\n    }\n    return new FailedOverEvent((Long) c.get(1), shardIds(c, 2));\n  }\n\n  /** Diagnostic shard-id list (stringified JSON array), logging only; required on the wire. */\n  private static String shardIds(List<Object> c, int i) {\n    return SafeEncoder.encode((byte[]) c.get(i));\n  }\n\n  /** MOVING target {@code host:port}; throws when the target is absent or unparseable. */\n  private static HostAndPort parseHostPort(List<Object> c, int i) {\n    if (i >= c.size() || !(c.get(i) instanceof byte[])) {\n      throw new MalformedMaintenanceEventException(\n          \"MOVING target must be a host:port byte[] at index \" + i + \": \" + c);\n    }\n    try {\n      return HostAndPort.from(SafeEncoder.encode((byte[]) c.get(i)));\n    } catch (Exception e) {\n      throw new MalformedMaintenanceEventException(\"Unparseable MOVING target: \" + c, e);\n    }\n  }\n\n  private static MalformedMaintenanceEventException malformed(String type, List<Object> c) {\n    return new MalformedMaintenanceEventException(\"Malformed \" + type + \" push: \" + c);\n  }\n\n  private MaintenancePushCodec() {\n  }\n}\n","sourceCodeStart":99,"sourceCodeEnd":134,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/MaintenancePushCodec.java#L99-L134","documentation":"When decoding a MOVING maintenance push event, Jedis expects the target field at the given index to be a byte[] containing \"host:port\". If the element is missing (index beyond the payload) or is not a byte array, the codec throws MalformedMaintenanceEventException with this message.","triggerScenarios":"A CLIENT push message of type MOVING whose reply structure deviates from the expected layout — e.g. the target element absent, replaced by a string/long, or the message truncated by a proxy or incompatible server version.","commonSituations":"Connecting through a proxy or load balancer that rewrites or truncates push payloads; a server emitting a MOVING event in a different format than the client expects; fuzzed/corrupted push frames.","solutions":["Verify the Redis server/proxy emits MOVING push events in the expected RESP array format with a byte[] host:port target","Capture and inspect the raw push payload (the message is appended in the exception) to identify the structural mismatch","Upgrade jedis and/or the server so both sides agree on the MOVING event schema"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  codec.decodeEvent(payload);\n} catch (MalformedMaintenanceEventException e) {\n  logger.warn(\"Dropping malformed MOVING push: {}\", e.getMessage());\n  // optionally reconnect to resynchronize push stream\n}","preventionTips":["Bypass or correctly configure proxies that rewrite RESP push frames","Keep server and client versions aligned on the maintenance event schema","Log raw payloads on decode failure to speed up protocol debugging"],"tags":["redis","push-events","protocol-parsing","malformed-data"],"backgroundTag":"unexpected-api-response-shape","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"}