{"record":{"id":"07af921200430dad","repo":"redis/jedis","slug":"stream-entry-deletion-result-value-cannot-be-null","errorCode":null,"errorMessage":"Stream entry deletion result value cannot be null","messagePattern":"Stream entry deletion result value cannot be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/resps/StreamEntryDeletionResult.java","lineNumber":79,"sourceCode":"        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() {\n    return name() + \"(\" + code + \")\";\n  }\n}\n","sourceCodeStart":61,"sourceCodeEnd":89,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/resps/StreamEntryDeletionResult.java#L61-L89","documentation":"StreamEntryDeletionResult.fromLong requires a non-null Long because a null means the server never returned a deletion result. Passing null is a programming error (missing reply, misparsed response, or caller passing an unset variable), so it fails fast with IllegalArgumentException.","triggerScenarios":"Calling fromLong(null) directly, or feeding a null builder/parse result (e.g. a missing reply element from a pipeline or transaction response) into fromLong.","commonSituations":"Pipelined/transactional responses where a reply slot is nil; custom response assembly code that maps results positionally and gets null for a failed command.","solutions":["Null-check the Redis reply before calling fromLong and handle the nil case explicitly","Verify the command actually succeeded (check pipeline/transaction replies for errors) before mapping its result","Only call fromLong on replies that are known Long values from XDELEX/XACKDEL"],"exampleFix":"// before\nStreamEntryDeletionResult r = StreamEntryDeletionResult.fromLong(reply);\n// after\nStreamEntryDeletionResult r = reply == null\n    ? StreamEntryDeletionResult.NOT_FOUND\n    : StreamEntryDeletionResult.fromLong(reply);","handlingStrategy":"type-guard","validationCode":"if (reply != null) {\n  StreamEntryDeletionResult r = StreamEntryDeletionResult.fromLong(reply);\n} else {\n  // handle nil reply explicitly\n}","typeGuard":"boolean hasDeletionResult(Long reply) { return reply != null; }","tryCatchPattern":null,"preventionTips":["Never feed pipeline/transaction replies into fromLong without checking each reply for null/errors","Check command success before mapping results"],"tags":["redis","streams","null-check"],"backgroundTag":"null-argument","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"}