microsoft/garnet · error · GarnetException

RI.DEL: invalid arguments.

Error message

RI.DEL: invalid arguments.

What it means

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.

Source

Thrown at libs/server/Storage/Session/MainStore/RangeIndexOps.cs:438

            {
                if (status != GarnetStatus.OK)
                {
                    result = RangeIndexResult.Error;
                    return status == GarnetStatus.WRONGTYPE ? GarnetStatus.WRONGTYPE : GarnetStatus.OK;
                }

                var treePtr = ExtractTreePtr(stubSpan);
                if (treePtr == 0)
                {
                    result = RangeIndexResult.Error;
                    return GarnetStatus.OK;
                }

                var deleteResult = BfTreeService.DeleteByPtr(treePtr, field);
                if (deleteResult != BfTreeDeleteResult.Success)
                {
                    logger?.LogError("RI.DEL: invalid arguments for a {fieldLen}-byte field.", field.Length);
                    throw new GarnetException("RI.DEL: invalid arguments.");
                }

                result = RangeIndexResult.OK;

                functionsState.rangeIndexManager.ReplicateRangeIndexDel(
                    key, field, functionsState.appendOnlyFile,
                    stringBasicContext.Session.Version, stringBasicContext.Session.ID,
                    functionsState.StoredProcMode);

                return GarnetStatus.OK;
            }
        }

        /// <summary>
        /// RI.SCAN — scan entries starting at a key with a count limit.
        /// Acquires shared lock, reads stub, writes complete RESP array response into output while lock is held.
        /// </summary>
        /// <param name="key">The Garnet key of the RangeIndex.</param>

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Ensure the field argument to RI.DEL is non-empty.
  2. If the error persists with valid input, recreate the range index.
  3. Check server logs for the logged field length to confirm the input.

Example fix

// before
RI.DEL myindex ""

// after
RI.DEL myindex "field1"
Defensive patterns

Strategy: validation

Validate before calling

if (field == null || field.Length == 0)
    throw new ArgumentException("RI.DEL field must be non-empty.");

Prevention

When it happens

Trigger: 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.

Common situations: Client sending RI.DEL with an empty field; argument parsing bug; corrupted range index state after unclean shutdown.

Related errors


AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13). Data as JSON: /api/errors/e4ad127a7ef13f7d. Report an issue: GitHub.