{"record":{"id":"e4ad127a7ef13f7d","repo":"microsoft/garnet","slug":"ri-del-invalid-arguments","errorCode":null,"errorMessage":"RI.DEL: invalid arguments.","messagePattern":"RI\\.DEL: invalid arguments\\.","errorType":"exception","errorClass":"GarnetException","httpStatus":null,"severity":"error","filePath":"libs/server/Storage/Session/MainStore/RangeIndexOps.cs","lineNumber":438,"sourceCode":"            {\n                if (status != GarnetStatus.OK)\n                {\n                    result = RangeIndexResult.Error;\n                    return status == GarnetStatus.WRONGTYPE ? GarnetStatus.WRONGTYPE : GarnetStatus.OK;\n                }\n\n                var treePtr = ExtractTreePtr(stubSpan);\n                if (treePtr == 0)\n                {\n                    result = RangeIndexResult.Error;\n                    return GarnetStatus.OK;\n                }\n\n                var deleteResult = BfTreeService.DeleteByPtr(treePtr, field);\n                if (deleteResult != BfTreeDeleteResult.Success)\n                {\n                    logger?.LogError(\"RI.DEL: invalid arguments for a {fieldLen}-byte field.\", field.Length);\n                    throw new GarnetException(\"RI.DEL: invalid arguments.\");\n                }\n\n                result = RangeIndexResult.OK;\n\n                functionsState.rangeIndexManager.ReplicateRangeIndexDel(\n                    key, field, functionsState.appendOnlyFile,\n                    stringBasicContext.Session.Version, stringBasicContext.Session.ID,\n                    functionsState.StoredProcMode);\n\n                return GarnetStatus.OK;\n            }\n        }\n\n        /// <summary>\n        /// RI.SCAN — scan entries starting at a key with a count limit.\n        /// Acquires shared lock, reads stub, writes complete RESP array response into output while lock is held.\n        /// </summary>\n        /// <param name=\"key\">The Garnet key of the RangeIndex.</param>","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Storage/Session/MainStore/RangeIndexOps.cs#L420-L456","documentation":"RI.DEL (RangeIndex DEL) throws when BfTreeService.DeleteByPtr returns any result other than Success. Unlike SET/GET which distinguish InvalidArguments from other results, DEL treats all non-success results as invalid arguments. This indicates the field span was structurally invalid or the tree handle was corrupted.","triggerScenarios":"Calling the RI.DEL operation when BfTreeService.DeleteByPtr returns anything other than BfTreeDeleteResult.Success. Occurs with an empty/null field span or a corrupted tree pointer.","commonSituations":"Client sending RI.DEL with an empty field; argument parsing bug; corrupted range index state after unclean shutdown.","solutions":["Ensure the field argument to RI.DEL is non-empty.","If the error persists with valid input, recreate the range index.","Check server logs for the logged field length to confirm the input."],"exampleFix":"// before\nRI.DEL myindex \"\"\n\n// after\nRI.DEL myindex \"field1\"","handlingStrategy":"validation","validationCode":"if (field == null || field.Length == 0)\n    throw new ArgumentException(\"RI.DEL field must be non-empty.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate field is non-empty before calling RI.DEL.","Ensure the range index tree handle is valid before deletion.","Log field length in error context for diagnosis."],"tags":["range-index","bftree","ri-del","runtime","garnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}