Edit: see https://github.com/CleverRaven/Cataclysm-DDA/issues/42002#issuecomment-656993566
DEBUG : error: tried to put an item into a pocket that can't fit into it while loading. err: item is too small
FUNCTION : void item_contents::combine(const item_contents&)
FILE : src/item_contents.cpp
LINE : 283
The items don't fall on the ground and don't get deleted.
none
- OS: Linux
- OS Version: LSB Version: :core-4.1-amd64:core-4.1-noarch; Distributor ID: Fedora; Description: Fedora release 32 (Thirty Two); Release: 32; Codename: ThirtyTwo;
- Game Version: 0.E-3920-g4ef634e [64-bit]
- Graphics Version: Tiles
- Game Language: System language []
- Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food]
]
Please note that is is also possible to create an "XL holster with sheath" by performing the steps 1 through 3 and then dropping the combat knife. This configuration will also fail to load. The loading code should probably be less aggressive.
debug.log
-----------------------------------------
10:19:00.797 : Starting log.
10:19:00.798 INFO : Cataclysm DDA version 0.E-3920-g4ef634e
10:19:00.798 INFO : [main] C locale set to C.UTF-8
10:19:00.798 INFO : [main] C++ locale set to C.UTF-8
10:19:00.798 INFO : SDL version used during compile is 2.0.4
10:19:00.798 INFO : SDL version used during linking and in runtime is 2.0.12
10:19:00.937 INFO : Number of render drivers on your system: 4
10:19:00.937 INFO : Render driver: 0/opengl
10:19:00.937 INFO : Render driver: 1/opengles2
10:19:00.938 INFO : Render driver: 2/opengles
10:19:00.938 INFO : Render driver: 3/software
10:19:00.940 INFO : [options] C locale set to C.UTF-8
10:19:00.940 INFO : [options] C++ locale set to C.UTF-8
10:19:00.947 INFO : Active renderer: 3/software
10:19:00.962 INFO : USE_COLOR_MODULATED_TEXTURES is set to 0
10:19:01.143 WARNING : opendir [./mods/] failed with "No such file or directory".
10:19:11.018 WARNING : opendir [./save/Saltillo/mods] failed with "No such file or directory".
10:19:17.511 INFO : Loaded tileset: retrodays
10:20:29.504 WARNING : opendir [./save/Saltillo/mods] failed with "No such file or directory".
10:20:35.724 INFO : Loaded tileset: retrodays
10:20:36.947 ERROR : (error message will follow backtrace)
./cataclysm-tiles(_Z21debug_write_backtraceRSo+0x38) [0xafa15d]
./cataclysm-tiles(_Z8DebugLog10DebugLevel10DebugClass+0x1e1) [0xafadf5]
./cataclysm-tiles(_Z12realDebugmsgPKcS0_S0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xb0) [0xafba83]
./cataclysm-tiles(_Z12realDebugmsgIINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvPKcS7_S7_S7_DpOT_+0x44) [0x9550c1]
./cataclysm-tiles(_ZN13item_contents7combineERKS_+0x2e9) [0xcb0b35]
./cataclysm-tiles(_ZN4item11deserializeER6JsonIn+0x23e) [0x110a650]
./cataclysm-tiles(_ZN6JsonIn4readI4itemEEDTcmcldtfp_11deserializedefpTELb1EERT_b+0x11) [0x939c91]
./cataclysm-tiles(_ZN6JsonIn4readINSt7__cxx114listI4itemSaIS3_EEELPv0EEEDTcmcldtfp_5frontELb1EERT_b+0xb9) [0x1126d65]
./cataclysm-tiles(_ZN9Character4loadERK10JsonObject+0x1d75) [0x1114df7]
./cataclysm-tiles(_ZN6player4loadERK10JsonObject+0x2f) [0x1116aa1]
./cataclysm-tiles(_ZN6avatar4loadERK10JsonObject+0x2f) [0x1117ac1]
./cataclysm-tiles(_ZN6avatar11deserializeER6JsonIn+0x35) [0x1118df3]
./cataclysm-tiles(_ZN4game11unserializeERSi+0xce2) [0x10f5f6a]
./cataclysm-tiles(_Z14read_from_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvRSiEE+0x85) [0xa2a8a1]
./cataclysm-tiles(_ZN4game4loadERK6save_t+0x1f0) [0xbd253c]
./cataclysm-tiles(_ZN9main_menu18load_character_tabEb+0x9eb) [0xdb6f8f]
./cataclysm-tiles(_ZN9main_menu14opening_screenEv+0xca7) [0xdbb0af]
./cataclysm-tiles(main+0x1766) [0x88cb15]
/lib64/libc.so.6(__libc_start_main+0xf2) [0x7dee1a28c042]
./cataclysm-tiles(_start+0x29) [0x914859]
Attempting to repeat stack trace using debug symbols…
debug_write_backtrace(std::ostream&)
??:?
DebugLog(DebugLevel, DebugClass)
??:?
realDebugmsg(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
??:?
void realDebugmsg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
??:?
item_contents::combine(item_contents const&)
??:?
item::deserialize(JsonIn&)
??:?
decltype ((({parm#1}.deserialize)(*this)),(true)) JsonIn::read<item>(item&, bool)
??:?
decltype ((({parm#1}.front)()),(true)) JsonIn::read<std::__cxx11::list<item, std::allocator<item> >, (void*)0>(std::__cxx11::list<item, std::allocator<item> >&, bool)
??:?
Character::load(JsonObject const&)
??:?
player::load(JsonObject const&)
??:?
avatar::load(JsonObject const&)
??:?
avatar::deserialize(JsonIn&)
??:?
game::unserialize(std::istream&)
??:?
read_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (std::istream&)> const&)
??:?
game::load(save_t const&)
??:?
main_menu::load_character_tab(bool)
??:?
main_menu::opening_screen()
??:?
main
??:?
__libc_start_main
??:?
_start
??:?
Backtrace emission took 1 seconds.
src/item_contents.cpp:283 [void item_contents::combine(const item_contents&)] error: tried to put an item into a pocket that can't fit into it while loading. err: item is too small
Edit: in light of new information revealed by more testing I now believe this to be a separate bug #42026
This would probably fix the edge case described above, but leave the following edge case uncovered:
This is not a complete fix, but it would make a whole class of bugs less severe. Examples: #41928 #41403 #41725
This risks:
This risks allowing something that should not be allowed
Change the loading code to not create a none and not delete items when it detects a rules violation
It does not delete items, it puts them into a hidden "migration" pocket and they drop a turn after you load.
It does not delete items, it puts them into a hidden "migration" pocket and they drop a turn after you load.
The sheath did drop, but I see no combat knife. The combat knife got deleted.
Conmfirmed in 0.E-3940-g0dc500f480
Spawned and inserted items as described - a combat knife, in a sheath, in an XL holster:
Game saved: Savegame-42002.zip
Immediately after loading the game (and skipping the debug message), the only thing in my inventory is "XL holster with none":
After waiting 1 turn, this turns into a plain "XL holster", and the "sheath" appears on the ground (though no drop message is displayed). The combat knife is nowhere to be found.
I think I know what is happening here.
"min_item_volume": "750 ml"
"volume": "500 ml"
when empty - too small to go in the XL holster1 L
- now it can go in the XL holsterSo, as long as the knife is loaded in the sheath first, it's large enough to be compatible with the XL holster. Perhaps when the items are loaded again, this insertion order is not preserved, or the sheath volume is not correctly recalculated before inserting it into the XL holster.
By setting "min_item_volume": "1 ml"
for the XL holster, I can load my save game with no errors - however, after loading, the XL holster contains only a sheath - the combat knife still disappears.
@wapcaplet, your observations prompted me to do more testing and I discovered that the XL holster has nothing to do with this bug: the sheath deletes the combat knife even without the holster.
After even more testing it looks like the sheath is also not necessary to trigger the bug. A combat knife combat knife disappears after the game is saved and reloaded if it is stored in:
A combat knife does not disappear if it is:
The disappearance itself does not trigger any assertions.
so by what wap is saying, i can say that the loading order is actually causing this issue; things load the "topmost" item first ,because that's how the json objects are nested. i do not have an idea for a fix at this time.
so by what wap is saying, i can say that the loading order is actually causing this issue; things load the "topmost" item first ,because that's how the json objects are nested. i do not have an idea for a fix at this time.
I believe you are mistaken, @KorGgenT. Here is a test that proves your hypothesis wrong by not triggering any assertions and not causing any items to disappear or be dropped on the ground:
Removing the gunmod_data
from the combat knife JSON data allowed me to save and load it successfully. I have not dug into the deeper reason yet, but all the other knives without gunmod_data
can correctly be saved and loaded.
The "RM42 fighting knife" and "sword bayonet" items also have gunmod_data
, and also cannot be saved/loaded.
I can confirm this is fixed by #41917. Tested OK in that branch:
All items were preserved on save/load:
It looks like this bug have been fixed.
Most helpful comment
I can confirm this is fixed by #41917. Tested OK in that branch:
All items were preserved on save/load: