egametang/ET · error
item config not found: {configId}
Error message
item config not found: {configId} What it means
Thrown by ItemHelper.AddItem when ItemConfigCategory.Get(configId) returns null. The config category is fetched as a singleton from the Fiber (self.Fiber().GetSingleton<ItemConfigCategory>()); a null result means no ItemConfig row exists for that configId in the loaded config table.
Source
Thrown at Packages/cn.etetet.item/Scripts/Hotfix/Server/ItemHelper.cs:39
/// 添加物品到背包
/// </summary>
/// <param name="self">物品组件</param>
/// <param name="configId">物品配置ID</param>
/// <param name="count">物品数量</param>
/// <param name="reason">道具变化原因</param>
/// <returns>是否添加成功</returns>
public static void AddItem(ItemComponent self, int configId, int count, ItemChangeReason reason)
{
if (count <= 0)
{
throw new Exception("invalid item count");
}
ItemConfigCategory itemConfigCategory = self.Fiber().GetSingleton<ItemConfigCategory>();
ItemConfig itemConfig = itemConfigCategory.Get(configId);
if (itemConfig == null)
{
throw new Exception($"item config not found: {configId}");
}
Log.Debug($"add item: configId={configId}, count={count}, reason={reason}");
int maxStack = itemConfig.MaxStack;
int remainCount = count;
List<long> updatedItemIds = new();
// 如果物品可堆叠,先尝试叠加到已有物品
if (maxStack > 1)
{
for (int i = 0; i < self.SlotItems.Count; ++i)
{
Item item = self.SlotItems[i];
if (item == null)
{
continue;
}View on GitHub (pinned to 5cab01f7a8)
Solutions
- Verify the configId exists in the ItemConfig table (Luban source) and that the server actually loaded it.
- Validate configId against ItemConfigCategory at the caller/handler boundary and reject unknown ids with an error code instead of letting AddItem throw.
- If the id comes from another table (e.g. a reward table), fix that table's reference.
Example fix
// before
ItemHelper.AddItem(comp, configId, count, reason);
// after
var cat = comp.Fiber().GetSingleton<ItemConfigCategory>();
if (cat.Get(configId) == null) { Log.Error($"unknown item {configId}"); return; }
ItemHelper.AddItem(comp, configId, count, reason); Defensive patterns
Strategy: validation
Validate before calling
var cat = comp.Fiber().GetSingleton<ItemConfigCategory>();
if (cat.Get(configId) == null)
{
Log.Error($"reject add: unknown configId {configId}");
return;
}
ItemHelper.AddItem(comp, configId, count, reason); Prevention
- Validate configId against ItemConfigCategory at the handler boundary.
- Keep the Luban item table and reward references in sync.
- Add a CI check that all configIds referenced in reward tables exist in ItemConfig.
When it happens
Trigger: AddItem is called with a configId that is absent from the ItemConfig table — either never defined, removed in a config update, or a wrong/typo id passed by a caller. The check is configId-based, independent of count.
Common situations: A new item reward references a configId that was never authored in Luban; a config table rebuild dropped a row; a client message sends a configId that is client-only and not in the server's loaded ItemConfigCategory; a typo or stale constant.
Related errors
- invalid capacity: {capacity}
- invalid item count
- bag is full
- invalid slot index: {slotIndex}
- slot index {slotIndex} exceeds capacity {self.Capacity}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/a1045ae3a754a76c.
Report an issue: GitHub.