# \[Custom Inventory\]: a custom add\_item\_error subclass passed to AddError arrives as a plain add\_item\_error

**URL:** <https://forums.unrealengine.com/t/custom-inventory-a-custom-add-item-error-subclass-passed-to-adderror-arrives-as-a-plain-add-item-error/2861470>\
**Category:** Issues and Bug Reporting\
**Tags:** unreal-editor-for-fortnite, Status-Open, fortnite-creative, fortnite\
**Created:** [November 24, 2026, 2:49pm UTC](https://forums.unrealengine.com/t/custom-inventory-a-custom-add-item-error-subclass-passed-to-adderror-arrives-as-a-plain-add-item-error/2861470 "2026-11-24T14:49:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smack](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/smack/32/1219598_2.png) [@smack](https://forums.unrealengine.com/u/smack)\
**Post date:** [November 24, 2026, 2:49pm UTC](https://forums.unrealengine.com/t/custom-inventory-a-custom-add-item-error-subclass-passed-to-adderror-arrives-as-a-plain-add-item-error/2861470/1 "2026-11-24T14:49:53Z")

</div>

### Summary

I made my own error type, `inventory_full_error` (a subclass of `add_item_error`), and used it to refuse an item in the inventory’s `OnReceive`.

The code that called `AddItem` does get one error back, but it is no longer an `inventory_full_error`: casting it to `inventory_full_error` fails. So the caller can’t find out why the item was refused.

### Please select what you are reporting on:

Verse

### What Type of Bug are you experiencing?

Verse

### Steps to Reproduce

1. Create a blank island and turn on Custom Items and Inventory in Project Settings.
2. Add the Verse file below and place `error_cast_test_device` in the level.
3. Launch a session. Everything runs in `OnBegin`; no player action is needed.
4. Read the Verse log.

```verse
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Itemization }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }

# Our own error type, so the caller can tell why the add failed.
inventory_full_error := class(add_item_error) {}

# An inventory that refuses every item with inventory_full_error.
refusing_inventory := class(inventory_component):
    OnReceive<override>(SceneEvent:scene_event):logic =
        if (Query := add_item_query_event[SceneEvent], Query.Inventory = Self):
            Query.AddError(inventory_full_error{})
            # Check 1: the error we just added, read back inside the query.
            if (Error := Query.Errors.Last[], inventory_full_error[Error]):
                Print("[in the query] expected: inventory_full_error, got: inventory_full_error")
            else:
                Print("[in the query] expected: inventory_full_error, got: add_item_error (not an inventory_full_error)")
        (super:)OnReceive(SceneEvent)

error_cast_test_device := class(creative_device):
    OnBegin<override>()<suspends>:void =
        Sleep(1.0)
        if (Sim := GetSimulationEntity[]):
            # An entity with our inventory, and a plain item, both in the scene.
            InventoryEntity := entity{}
            Inventory := refusing_inventory{Entity := InventoryEntity}
            InventoryEntity.AddComponents(array{Inventory})
            Item := entity{}
            Item.AddComponents(array{item_component{Entity := Item}})
            Sim.AddEntities(array{InventoryEntity, Item})

            # Check 2: the same error, as the caller of AddItem receives it.
            if (Errors := Inventory.AddItem(Item).GetError[], Error := Errors[0]):
                if (inventory_full_error[Error]):
                    Print("[caller] expected: inventory_full_error, got: inventory_full_error ({Errors.Length} error)")
                else:
                    Print("[caller] expected: inventory_full_error, got: add_item_error (not an inventory_full_error) ({Errors.Length} error)")
            else:
                Print("[caller] expected: AddItem to fail, got: success")

```

### Expected Result

The caller receives the error that was passed to `AddError`, so both checks find an `inventory_full_error`:

```auto
[in the query] expected: inventory_full_error, got: inventory_full_error
[caller] expected: inventory_full_error, got: inventory_full_error (1 error)

```

### Observed Result

The error is an `inventory_full_error` inside the query, but the caller’s only error is not:

```auto
[in the query] expected: inventory_full_error, got: inventory_full_error
[caller] expected: inventory_full_error, got: add_item_error (not an inventory_full_error) (1 error)

```

The same happens with `CanAddItem`, with `remove_item_error` subclasses on `CanRemoveItem` and `RemoveItem`, and with `<castable>` on the subclass.

**Workaround**

None through the errors. A caller that needs the reason has to ask the inventory directly, through a separate Verse method that repeats the inventory’s checks.

### Platform(s)

Base: 6.0.0-60803671+++Fortnite+Release-43.11  
Version: 6.0.0-60809112+++Fortnite+Release-43.12  
Platform: Windows 10 (22H2) [10.0.19045.6466] (x86\_64)

### Additional Notes

**Use case:**  
An inventory refuses items for different reasons (for example “locked” vs “no room”), and the code that tried the add needs the reason to show the right message. `add_item_error` and `remove_item_error` have no fields, so a subclass is the only way to carry a reason. The docs recommend exactly this: [Inventory Component in Fortnite](https://dev.epicgames.com/documentation/fortnite/inventory-component-in-fortnite) says “You can write a unique error class to be used in these instances” and defines `no_slots_add_item_error := class(add_item_error)`.

If errors are meant to be opaque, please say so in the docs and offer another way to pass a refusal reason to the caller (a field on the base error classes would do).

---

<div class="post-metadata">

**Author:** ![Bug-Reporter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bug-reporter/32/1223650_2.png) [@Bug-Reporter](https://forums.unrealengine.com/u/Bug-Reporter)\
**Post date:** [November 24, 2026, 5:41pm UTC](https://forums.unrealengine.com/t/custom-inventory-a-custom-add-item-error-subclass-passed-to-adderror-arrives-as-a-plain-add-item-error/2861470/2 "2026-11-24T17:41:28Z")

</div>

FORT-1202845 has been created and its status is ‘Unconfirmed’. This is now in a queue to be reproduced and confirmed.
