{"record":{"id":"8fb1e423106aae56","repo":"redis/jedis","slug":"unknown-stream-entry-deletion-result-code-code","errorCode":null,"errorMessage":"Unknown stream entry deletion result code: ${code}","messagePattern":"Unknown stream entry deletion result code: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/resps/StreamEntryDeletionResult.java","lineNumber":67,"sourceCode":"    return code;\n  }\n\n  /**\n   * Creates a StreamEntryDeletionResult from the numeric code returned by Redis.\n   * @param code the numeric code from Redis\n   * @return the corresponding StreamEntryDeletionResult\n   * @throws IllegalArgumentException if the code is not recognized\n   */\n  public static StreamEntryDeletionResult fromCode(int code) {\n    switch (code) {\n      case -1:\n        return NOT_FOUND;\n      case 1:\n        return DELETED;\n      case 2:\n        return NOT_DELETED_UNACKNOWLEDGED_OR_STILL_REFERENCED;\n      default:\n        throw new IllegalArgumentException(\"Unknown stream entry deletion result code: \" + code);\n    }\n  }\n\n  /**\n   * Creates a StreamEntryDeletionResult from a Long value returned by Redis.\n   * @param value the Long value from Redis\n   * @return the corresponding StreamEntryDeletionResult\n   * @throws IllegalArgumentException if the value is null or not recognized\n   */\n  public static StreamEntryDeletionResult fromLong(Long value) {\n    if (value == null) {\n      throw new IllegalArgumentException(\"Stream entry deletion result value cannot be null\");\n    }\n    return fromCode(value.intValue());\n  }\n\n  @Override\n  public String toString() {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/resps/StreamEntryDeletionResult.java#L49-L85","documentation":"StreamEntryDeletionResult.fromCode converts an integer result code returned by Redis's XDELEX/XACKDEL commands into the enum. This IllegalArgumentException is thrown when the server returns a code the client does not recognize (anything outside 0,1,2), typically meaning the client's enum predates a newer Redis server version or the protocol changed.","triggerScenarios":"Calling XDELEX/XACKDEL (via stream entry deletion APIs) against a Redis server that returns an unmapped result code for an entry, e.g. a new code added by a newer server release while the Jedis version only knows 0=NOT_FOUND, 1=DELETED, 2=NOT_DELETED_UNACKNOWLEDGED_OR_STILL_REFERENCED.","commonSituations":"Running a newer Redis (e.g. Redis 8.x with extended deletion semantics) with an older Jedis; custom/proxy Redis implementations returning non-standard codes; protocol regressions after upgrades.","solutions":["Upgrade Jedis to the latest release so the enum maps all codes your Redis server can return","Pin your Redis server to a version whose XDELEX/XACKDEL result codes are covered by your Jedis version","Wrap the call in try-catch for IllegalArgumentException and treat unknown codes conservatively (e.g. re-check entry existence)"],"exampleFix":"// before (older Jedis)\nStreamEntryDeletionResult r = StreamEntryDeletionResult.fromLong(result);\n// after (upgrade dependency, or guard)\ntry {\n  StreamEntryDeletionResult r = StreamEntryDeletionResult.fromLong(result);\n} catch (IllegalArgumentException e) {\n  // unknown code: fall back to explicit existence check\n}","handlingStrategy":"try-catch","validationCode":"if (reply == null || !(reply instanceof Long)) throw new IllegalStateException(\"unexpected XDELEX reply\");\nif (!List.of(0L,1L,2L).contains((Long) reply)) { /* treat as unknown, handle explicitly */ }","typeGuard":null,"tryCatchPattern":"try {\n  StreamEntryDeletionResult r = StreamEntryDeletionResult.fromLong(longReply);\n} catch (IllegalArgumentException e) {\n  // log code, fall back to NOT_FOUND-like handling or XPENDING/exists check\n}","preventionTips":["Keep Jedis and Redis server versions compatible","Check release notes for new XDELEX/XACKDEL result codes before upgrading the server","Wrap stream-deletion result mapping in a small helper that handles unknown codes"],"tags":["redis","streams","unknown-enum-code","version-mismatch"],"backgroundTag":"invalid-enum-value","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"}