Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Saving Inventory Bug #67

Description

@DarkBytesx

Getting a nil value error when syncInventory is called during server restart/shutdown period.
Error Message
@ox_inventory/modules/bridge/esx/server.lua:56: attempt to index a nil value (local 'player')

Steps to Reproduce
Wait until server restart is approaching (1-5 minutes before restart)
Trigger inventory save operation (e.g., /saveinv command)
Error is thrown in console

Framework: ESX

Code Location
File: ox_inventory/modules/bridge/esx/server.lua
Line: 56

    local accounts = Inventory.GetAccountItemCounts(inv)

    if accounts then
        local player = server.GetPlayerFromId(inv.id)
        player.syncInventory(inv.weight, inv.maxWeight, inv.items, accounts)
        -- ^ Error occurs here when player is nil
    end
end```

<img width="1233" height="94" alt="Image" src="https://github.com/user-attachments/assets/e925fe85-df4d-47c7-a260-8a99f6975810" />

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions