redis/jedis · error · MalformedMaintenanceEventException

Unparseable MOVING target:

Error message

Unparseable MOVING target: 

What it means

After confirming the MOVING target element is a byte[], the codec attempts HostAndPort.from(new String(bytes)). If the bytes do not parse as host:port, the original exception is wrapped in MalformedMaintenanceEventException("Unparseable MOVING target: ...", e).

Solutions

  1. Check the raw target string in the exception message and correct the server-side endpoint configuration (valid host:port)
  2. For IPv6 targets, ensure the server emits bracketed literals that HostAndPort can parse
  3. Upgrade jedis if a newer HostAndPort parser supports the target format being sent
Defensive patterns

Strategy: try-catch

Try / catch

try {
  HostAndPort target = codec.parseMovingTarget(raw);
} catch (MalformedMaintenanceEventException e) {
  logger.warn("Unparseable MOVING target from server: {}", e.getMessage());
}

Prevention

When it happens

Trigger: A MOVING push event whose target bytes are not a valid host:port pair — e.g. missing port, hostname containing invalid characters, IPv6 literal without brackets, or empty target bytes sent by the server.

Common situations: Server/proxy emitting non-standard endpoint formats (e.g. unix socket paths or IPv6 without brackets); localization/encoding issues corrupting the payload; misconfigured managed-Redis endpoint announcements.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/15622d7b758c9ce0. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/MaintenancePushCodec.java:123

    }
    return new FailedOverEvent((Long) c.get(1), shardIds(c, 2));
  }

  /** Diagnostic shard-id list (stringified JSON array), logging only; required on the wire. */
  private static String shardIds(List<Object> c, int i) {
    return SafeEncoder.encode((byte[]) c.get(i));
  }

  /** MOVING target {@code host:port}; throws when the target is absent or unparseable. */
  private static HostAndPort parseHostPort(List<Object> c, int i) {
    if (i >= c.size() || !(c.get(i) instanceof byte[])) {
      throw new MalformedMaintenanceEventException(
          "MOVING target must be a host:port byte[] at index " + i + ": " + c);
    }
    try {
      return HostAndPort.from(SafeEncoder.encode((byte[]) c.get(i)));
    } catch (Exception e) {
      throw new MalformedMaintenanceEventException("Unparseable MOVING target: " + c, e);
    }
  }

  private static MalformedMaintenanceEventException malformed(String type, List<Object> c) {
    return new MalformedMaintenanceEventException("Malformed " + type + " push: " + c);
  }

  private MaintenancePushCodec() {
  }
}

View on GitHub (pinned to 6dac31d4c2)