"Attempted to add item to category %s, but the item ID is nil." at login
lorenzo-costigliola opened this issue · 11 comments
Describe the bug
At login the following in game Lua error appears
Message: Interface/AddOns/BetterBags/data/categories.lua:52: bad argument #2 to 'format' (string expected, got nil)
Time: Mon Mar 4 08:54:47 2024
Count: 1
Stack: Interface/AddOns/BetterBags/data/categories.lua:52: bad argument #2 to 'format' (string expected, got nil)
[string "=[C]"]: in function format' [string "@Interface/AddOns/BetterBags/data/categories.lua"]:52: in function
AddItemToCategory'
[string "@Interface/AddOns/BetterBags_Secrets/Core.lua"]:36: in main chunk
Locals: (*temporary) = "Attempted to add item to category %s, but the item ID is nil."
(*temporary) = nil
(*temporary) = "string expected, got nil"
To Reproduce
Just log in into the game
- Retail 10.2.5.53441
- 0.1.14
- 1.03
- Above
Expected behavior
No getting the login Lua error
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
The problem happens on 7 different characters always at login and/or reload (never at other times).
I'm playing on Nemesis (EU-IT). Not sure if there might be some translation issues
It might be a translation issue. I will look into it. You are playing with Italian as your language?
See if 1.04 fixes the issue. If you wish to help even more, please contribute translations.
I learned that GetFactionInfoByID() does not work if the player's base faction (Alliance or Horde) can never learn the faction I want, or Honeyback Hive, in this case. Horde characters will get an error.
I switched to an internal localization of "Honeyback Hive" rather than using WoW to translate it. I never got the error myself because I play Alliance, and the "Honeyback Hive" reputation is valid for Alliance. I had to create a Horde character to see the error.
The error should finally be fixed with 1.05. I created a Horde character to test. While I translated "Honeyback Hive" online, I did so after 1.05 was released. Whenever 1.06 goes live, you will see it localized within the addon.
I do not think it is because you are playing on an Italian server. There must be something else going on.
I confirmed it has nothing to do with your language; it is because you are playing a Horde character, and the "Honeyback Hive" faction does not exist for Horde. I worked around that by directly localizing "Honeyback Hive" instead of having WoW localize the term, which will be nil for Horde characters if I get WoW to localize it.
That workaround was in 1.05, and when I logged into a Horde character, the error stopped. I have not been able to replicate the error since 1.05 on either Alliance or Horde.
What you may need to do is exit WoW then browse your computer to \World of Warcraft\_retail_\WTF\account\Your Account Name\SavedVariables\
and delete BetterBags.lua. Deleting that file will reset BetterBags and its settings back to default.
The only other thing I can do is check if the player is Alliance. If yes, create the virtual group in BetterBags. If no, the player is Horde, then delete the group, or at least do not create it.
The issue with not creating the "Honeyback Hive" group if the player is Horde is that should the player log into an Alliance character, the group will be created for BOTH factions. Because of how BetterBags works, I cannot stop the creation based on the player's faction permanently.
What I mean by that is that I can perform a logic check "if player == 'Alliance' then create group, elseif player == 'Horde' then delete group", but that will error because the group is created for Horde in the first place. There is no way to stop the creation.
The group needs to exist (IE: be created) to delete it, and merely creating the group will error for Horde.
What I have done as of 1.05 is the best possible solution: do not use WoW to translate "Honeyback Hive" and translate "Honeyback Hive" internally to Secrets.
But like I said above, if you are still getting the error with 1.05, 1.06, 1.07 or later, you probably need to delete the settings file for BetterBags. Something in its settings is being kept that is causing the error. Starting fresh will reset and avoid the error.