microsoft/FASTER · error · FasterException

Unsupported object size:

Error message

Unsupported object size: 

What it means

AddressInfo packs an object/reference size into a limited bit field (kSizeBits). When the requested size is so large that the normalized value (value >> 20, rounded up) exceeds the capacity of the size field, the setter throws FasterException("Unsupported object size: " + value). The size cannot be encoded in the address record, so the operation cannot proceed.

Solutions

  1. Reduce the object size (store it out-of-band via an offset to a heap device instead of a directly-sized record).
  2. Run in x64 mode/process so 64-bit AddressInfo encoding with wider fields is used.
  3. Increase allocation limits configuration or chunk the data into smaller records.
  4. Check kSizeBits/AddressInfo encoding for your build (32 vs 64 bit) and ensure sizes stay under the encodable maximum.

Example fix

// before
byte[] payload = new byte[3_000_000_000]; // > encodable max
var info = new AddressInfo { Size = payload.Length }; // FasterException: Unsupported object size

// after
// store large payloads out-of-band
var deviceOffset = heapDevice.Append(payload);
var info = new AddressInfo { Address = deviceOffset, Size = payload.Length }; // fits as a reference
Defensive patterns

Strategy: validation

Validate before calling

// ensure size is encodable before constructing AddressInfo
bool IsEncodableSize(long size) => (size >> 20) + ((size & ((1 << 20) - 1)) != 0 ? 1 : 0) < (1 << AddressInfo.KSizeBits);

Prevention

When it happens

Trigger: Setting an AddressInfo (e.g. when allocating a huge HLGCache value or oversize object reference) where value >> 20 >= (1 << kSizeBits), i.e. the object size exceeds the maximum encodable size (on 32-bit or in compact overflow mode).

Common situations: Storing extremely large values (hundreds of MB to GB) as inline objects; running in 32-bit/x86 mode where AddressInfo fields are narrow; misconfigured MaxSize or value-count limits allowing oversized allocations.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/ec4dfcc8ba51bde6. Report an issue: GitHub.

Appendix: source

Thrown at cs/src/core/Index/Common/AddressInfo.cs:63

            readonly get
            {
                int multiplier = (int)((((long)word & kMultiplierMaskInWord) >> (kAddressBits + kSizeBits)) & kMultiplierMaskInInteger);
                return (multiplier == 0 ? 512 : 1<<20)*((((long)word & kSizeMaskInWord) >> kAddressBits) & kSizeMaskInInteger);
            }
            set
            {
                int multiplier = 0;
                int val = (int)(value >> 9);
                if ((value & ((1<<9)-1)) != 0) val++;

                if (val >= (1 << kSizeBits))
                {
                    val = (int)(value >> 20);
                    if ((value & ((1<<20) - 1)) != 0) val++;
                    multiplier = 1;
                    if (val >= (1 << kSizeBits))
                    {
                        throw new FasterException("Unsupported object size: " + value);
                    }
                }
                var _word = (long)word;
                _word &= ~kSizeMaskInWord;
                _word &= ~kMultiplierMaskInWord;
                _word |= (val & kSizeMaskInInteger) << kAddressBits;
                _word |= (multiplier & kMultiplierMaskInInteger) << (kAddressBits + kSizeBits);
                word = (IntPtr)_word;
            }
        }

        public long Address
        {
            readonly get
            {
                return (long)word & kAddressMask;
            }
            set

View on GitHub (pinned to 321d872eab)