Console Spam

(22:23:41) | Failed to call hook 'OnEntityTakeDamage' on plugin 'TruePVE v2.4.8' (NullReferenceException: Object reference not set to an instance of an object)

at UnityEngine.GameObjectEx.ToBaseEntity (UnityEngine.GameObject go, System.Boolean allowDestroyed) [0x00000] in <ba6272a5951747a68986252fad12d96e>:0

at BaseNetworkable.LookupPrefab () [0x00011] in <ba6272a5951747a68986252fad12d96e>:0

at Oxide.Plugins.TruePVE.GetTypeName (BaseEntity entity, System.String defaultValue) [0x00020] in <8b0b68a5103f424f9df4c01540d32c01>:0

at Oxide.Plugins.TruePVE+Configuration.ResolveEntityGroups (BaseEntity entity) [0x0004e] in <8b0b68a5103f424f9df4c01540d32c01>:0

at Oxide.Plugins.TruePVE.EvaluateRules (BaseEntity entity, BaseEntity attacker, Oxide.Plugins.TruePVE+RuleSet ruleSet, System.Boolean returnDefaultValue) [0x0000d] in <8b0b68a5103f424f9df4c01540d32c01>:0

at Oxide.Plugins.TruePVE.AllowDamage (BaseEntity entity, HitInfo info) [0x01ede] in <8b0b68a5103f424f9df4c01540d32c01>:0

at Oxide.Plugins.TruePVE.OnEntityTakeDamage (BaseEntity entity, HitInfo info) [0x00016] in <8b0b68a5103f424f9df4c01540d32c01>:0

at Oxide.Plugins.TruePVE.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00d98] in <8b0b68a5103f424f9df4c01540d32c01>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <42f9bedc659b4f4786eb778d3cd58968>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in <db058accaef24d86af67c0d18d641acb>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <db058accaef24d86af67c0d18d641acb>:0

Same here. It happened after the server updated with the 11/23/2026 patch

TruePVE v2.4.8 throws a NullReferenceException in GetTypeName() when an entity’s prefab cannot be found. LookupPrefab() calls FindPrefab(prefabID).ToBaseEntity() internally without checking whether the returned GameObject is null, so TruePVE’s existing null check runs too late.

The fix replaces LookupPrefab() with an explicit lookup and guarded conversion:

GameObject prefabObject = entity.gameManager.FindPrefab(prefabID);
BaseEntity prefab = prefabObject == null
    ? null
    : prefabObject.ToBaseEntity();

If the prefab or its BaseEntity component is missing, it returns entity.GetType().Name without caching that fallback. Entities with prefab ID 0 also use their live type directly, preventing unrelated entities from sharing an incorrect cached type.

Valid prefabs retain the existing type caching. Carbon compiled and reloaded the patched plugin successfully; isolated regression checks passed.



Merged post

For users:

Temporary fix for the TruePVE v2.4.8 OnEntityTakeDamage null-reference error with this stack trace:

GameObjectEx.ToBaseEntity
BaseNetworkable.LookupPrefab
TruePVE.GetTypeName

This happens when the prefab lookup returns null. Rust’s LookupPrefab() tries to convert that missing prefab before TruePVE can check it.

To apply the fix:

  1. Back up TruePVE.cs.
  2. Open carbon/plugins/TruePVE.cs or oxide/plugins/TruePVE.cs.
  3. Find private string GetTypeName( and replace that entire method with the following. Keep the _typeNameLookup dictionary declaration immediately above it.
private string GetTypeName(BaseEntity entity, string defaultValue = "Unknown")
{
    if (entity == null)
    {
        return defaultValue;
    }

    uint prefabID = entity.prefabID;
    if (prefabID == 0)
    {
        return entity.GetType().Name;
    }

    if (!_typeNameLookup.TryGetValue(prefabID, out string name))
    {
        // Guard the GameObject before calling ToBaseEntity.
        GameObject prefabObject = entity.gameManager.FindPrefab(prefabID);
        BaseEntity prefab = prefabObject == null
            ? null
            : prefabObject.ToBaseEntity();

        if (prefab == null)
        {
            // Do not cache a fallback for a missing prefab.
            return entity.GetType().Name;
        }

        _typeNameLookup[prefabID] = name = prefab.GetType().Name;
    }

    return name;
}

Save the file, reload TruePVE, and check the console for a successful load.

This preserves normal prefab type caching and uses the live entity’s type when its prefab is unavailable. It does not change your configured damage rules.

The patch compiled and loaded successfully on Carbon, and isolated regression checks passed. Plugin updates may overwrite this edit.

that worked, Now just getting "NullReferenceException: Object reference not set to an instance of an object"

hi, this is not an issue with truepve. this is an issue with plugins not setting prefabID after it was changed today. that is what causes the error.

applying the above patch will not fix anything, it will merely hide the error. in order to fix the issue, you must update any and all npc plugins such as NpcSpawn, ZombieHorde (when it becomes available), RaidableBases and DangerousTreasures.

you will still get other errors until you do so.

Locked