Issue Game crashes with Animal husbandry items (I guess)

Mr_Jakob99

Farmhand
So the game always crashes at the same spot. I go out, I take the syringe out of the mail I just got, go to my coop and there I want to place the syringe in a chest inside where I keep my animal handling items. When I open the chest everything is fine, I can move my mouse all around etc. But when I'm just before the syringe with my mouse (just before the Item would be maked as selected if you might say so) to click on it to put it in the chest, the game crashes. I don't get a real error in my log about it and all I could get is a picture of the screen recording I made from the SAMPI console because it closes so fast when crashing.
1635254328359.png

This was the last message.
All the coop just got the lvl 3 upgrade. Before I updated some mods. One uses Mail Framework where an error is present and Animal Husbandry uses it to, so maybe there is a problem?
And this is the Game log: https://smapi.io/log/a4b53c995275429cba193a3adaa3b846

I'm on Linux btw. Thanks in advance.
 
Last edited by a moderator:
Hey, I took a bit of a look at this. As I play on Linux as well.
But, I see you were also chatting with Digus about this on his Animal Husbandry nexus mod page.

As Digus mentioned; it seems to be an issue with Attachment Slots. As I can confirm it crashes for me as well with the basket, & syringe from the AH mod.

Partial/Temporary Fix:
But, I found that there's a hacky, temporary workaround for this issue. We can get the tools(Basket/Syringe) working with some save editing.
Everything will work fine, except being able to visibly see the attached items. You can still attach/detach items by right clicking, and use the tools with left click(or whatever keys you use).

1. Info on the basics of save editing if you need it: https://stardewvalleywiki.com/Saves#Edit_a_save

2. Open your save, and find the item tool code for the Basket, & Syringe.

Code:
<Item xsi:type="MilkPail">
        <isLostItem>false</isLostItem>
        <category>-99</category>
        <hasBeenInInventory>false</hasBeenInInventory>
        <name>Feeding Basket</name>
        <specialItem>false</specialItem>
        <modData>
          <item>
            <key>
              <string>DIGUS.ANIMALHUSBANDRYMOD/FeedingBasket</string>
            </key>
            <value>
              <string>818071520</string>
            </value>
          </item>
        </modData>
        <SpecialVariable>0</SpecialVariable>
        <DisplayName>Feeding Basket</DisplayName>
        <Name>Feeding Basket</Name>
        <Stack>1</Stack>
        <initialParentTileIndex>519</initialParentTileIndex>
        <currentParentTileIndex>519</currentParentTileIndex>
        <indexOfMenuItemView>519</indexOfMenuItemView>
        <stackable>false</stackable>
        <instantUse>false</instantUse>
        <isEfficient>false</isEfficient>
        <animationSpeedModifier>1</animationSpeedModifier>
        <upgradeLevel>0</upgradeLevel>
        <numAttachmentSlots>1</numAttachmentSlots>
        <attachments>
          <Object xsi:nil="true" />
        </attachments>
        <BaseName>Feeding Basket</BaseName>
        <InitialParentTileIndex>519</InitialParentTileIndex>
        <IndexOfMenuItemView>519</IndexOfMenuItemView>
        <InstantUse>false</InstantUse>
        <IsEfficient>false</IsEfficient>
        <AnimationSpeedModifier>1</AnimationSpeedModifier>
        <Stackable>false</Stackable>
      </Item>
      <Item xsi:type="MilkPail">
        <isLostItem>false</isLostItem>
        <category>-99</category>
        <hasBeenInInventory>false</hasBeenInInventory>
        <name>Insemination Syringe</name>
        <specialItem>false</specialItem>
        <modData>
          <item>
            <key>
              <string>DIGUS.ANIMALHUSBANDRYMOD/InseminationSyringe</string>
            </key>
            <value>
              <string>1863006810</string>
            </value>
          </item>
        </modData>
        <SpecialVariable>0</SpecialVariable>
        <DisplayName>Insemination Syringe</DisplayName>
        <Name>Insemination Syringe</Name>
        <Stack>1</Stack>
        <initialParentTileIndex>518</initialParentTileIndex>
        <currentParentTileIndex>518</currentParentTileIndex>
        <indexOfMenuItemView>518</indexOfMenuItemView>
        <stackable>false</stackable>
        <instantUse>false</instantUse>
        <isEfficient>false</isEfficient>
        <animationSpeedModifier>1</animationSpeedModifier>
        <upgradeLevel>0</upgradeLevel>
        <numAttachmentSlots>1</numAttachmentSlots>
        <attachments>
          <Object xsi:nil="true" />
        </attachments>
        <BaseName>Insemination Syringe</BaseName>
        <InitialParentTileIndex>518</InitialParentTileIndex>
        <IndexOfMenuItemView>518</IndexOfMenuItemView>
        <InstantUse>false</InstantUse>
        <IsEfficient>false</IsEfficient>
        <AnimationSpeedModifier>1</AnimationSpeedModifier>
        <Stackable>false</Stackable>
      </Item>

3. All we have to do is change the value of "<numAttachmentSlots>" to 0; for both those tools.
Example:
<numAttachmentSlots>0</numAttachmentSlots>

4. Save, and as mentioned above. The tools will work as intended with the exception that attached items are hidden from the player.
Attaching, and detaching items to & from the syringe, & basket will work fine. And obviously, there's no more crashes.
 

Mr_Jakob99

Farmhand
2. Open your save, and find the item tool code for the Basket, & Syringe.
Okay I have a Question: I found the feeding Basked in the code and changed it. I also saw the Meat Cleaver. But I could not find the Syringe. Is that because I don't have the syringe? Because I deactivated Pregnancy in the mod config, so I can play without crashing the game by mistake because I got the syringe that day.
Do I now have to reactivate pregnancy and then survive a day without touching it?
 
Okay I have a Question: I found the feeding Basked in the code and changed it. I also saw the Meat Cleaver. But I could not find the Syringe. Is that because I don't have the syringe? Because I deactivated Pregnancy in the mod config, so I can play without crashing the game by mistake because I got the syringe that day.
Do I now have to reactivate pregnancy and then survive a day without touching it?
Ah yea, if you deleted the syringe/disabled pregnancy in the config; then you'll need to reenable/reacquire it, and save.

It should come pretty quickly, but you can also just paste into the SMAPI console while the game is running:
player_addinseminationsyringe

And, that'll directly add it into your inventory; then you can save. If you do it right before bed; it should help you get through the day a bit easier.
 
No prob! And, just a little follow up.

TLDR:
It appears that AH is having a conflict with Platonymous' PyTK mod.
As temporarily removing PyTK, allows AH to work without issue; no save editing workaround needed.

Extra Info:
I was a little annoyed that SMAPI would just crash without writing anything helpful to the log. So I ended up doing an strace on SMAPI with my current mods.
The strace log showed that PyTK was the last mod active before the game locked up.

Code:
openat(AT_FDCWD, "/media/MysticTempest/1cb85229-4d9f-4b9a-bbec-34ec190cba3f/Linux Steam/steamapps/common/Stardew Valley_Modded_154/Content/Data/BigCraftablesInformation.xnb", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0775, st_size=4990, ...}) = 0
fstat(19, {st_mode=S_IFREG|0775, st_size=4990, ...}) = 0
read(19, "XNBw\5\201~\23\0\0%G\0\0\377G%\23f\4\20Rr\0\0C#VE\0\0\\"..., 4096) = 4096
read(19, "/b\377\355\263$\246u\233\fO\351\364,\235\255\201Y\310\177e\310\203SB\2171\343y\213M\253"..., 4096) = 894
lseek(19, 4985, SEEK_SET)               = 4985
read(19, "\0\0\0\0\0", 4096)            = 5
close(19)                               = 0
lseek(4, 18132, SEEK_SET)               = 18132
write(4, "[12:31:10 TRACE SMAPI] PyTK edit"..., 67) = 67
lseek(4, 18199, SEEK_SET)               = 18199
write(4, "[12:31:10 TRACE SMAPI] Invalidat"..., 141) = 141
getpid()                                = 30833
tgkill(30833, 30865, SIGPWR)            = 0
getpid()                                = 30833
tgkill(30833, 30864, SIGPWR)            = 0
getpid()                                = 30833
tgkill(30833, 30846, SIGPWR)            = 0
getpid()                                = 30833
tgkill(30833, 30839, SIGPWR)            = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d74793000
munmap(0x7f2d74793000, 4096)            = 0
getpid()                                = 30833
tgkill(30833, 30865, SIGXCPU)           = 0
getpid()                                = 30833
tgkill(30833, 30864, SIGXCPU)           = 0
getpid()                                = 30833
tgkill(30833, 30846, SIGXCPU)           = 0
getpid()                                = 30833
tgkill(30833, 30839, SIGXCPU)           = 0
lseek(4, 18340, SEEK_SET)               = 18340
write(4, "[12:31:10 TRACE game] Window_Cli"..., 107) = 107
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLIN|POLLOUT}])
recvmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="#\203\310\2\6\0\0\0\21\0\2\0\256/\373\265\0\0\0\0\n\0\2\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 384
writev(5, [{iov_base="\f\0\5\0\n\0\300\2\f\0\0\0\0\5\0\0\320\2\0\0", iov_len=20}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 20
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc04038540) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_WAIT_IDLE, 0x7ffc04038840) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_WAIT_IDLE, 0x7ffc04038870) = 0
munmap(0x7f2ce5f68000, 98304)           = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2c8aed7000, 2265088)         = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2c8a7bb000, 2359296)         = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2ce5ee8000, 262144)          = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2d742ba000, 20480)           = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc04038540) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_BUSY, 0x7ffc040383b0) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc04039220) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc04039010) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_MMAP, 0x7ffc04039470) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 8, 0x1012f1000) = 0x7f2d74793000
ioctl(8, DRM_IOCTL_RADEON_GEM_BUSY, 0x7ffc04039640) = 0
futex(0x29180ec, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x2918098, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x3377520, FUTEX_WAIT_BITSET, 2, NULL, 0xffffffff) = -1 EAGAIN (Resource temporarily unavailable)
ioctl(8, DRM_IOCTL_RADEON_GEM_WAIT_IDLE, 0x7ffc040397f0) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_WAIT_IDLE, 0x7ffc04039820) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc040397e0) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc04037530) = 0)           = 0
getpid()                                = 30833
tgkill(30833, 30846, SIGXCPU)           = 0
getpid()                                = 30833
tgkill(30833, 30839, SIGXCPU)           = 0
lseek(4, 18340, SEEK_SET)               = 18340
write(4, "[12:31:10 TRACE game] Window_Cli"..., 107) = 107
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLIN|POLLOUT}])
recvmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="#\203\310\2\6\0\0\0\21\0\2\0\256/\373\265\0\0\0\0\n\0\2\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 384
writev(5, [{iov_base="\f\0\5\0\n\0\300\2\f\0\0\0\0\5\0\0\320\2\0\0", iov_len=20}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 20
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
ioctl(8, DRM_IOCTL_RADEON_GEM_CREATE, 0x7ffc04038540) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_WAIT_IDLE, 0x7ffc04038840) = 0
ioctl(8, DRM_IOCTL_RADEON_GEM_WAIT_IDLE, 0x7ffc04038870) = 0
munmap(0x7f2ce5f68000, 98304)           = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2c8aed7000, 2265088)         = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2c8a7bb000, 2359296)         = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2ce5ee8000, 262144)          = 0
ioctl(8, DRM_IOCTL_GEM_CLOSE, 0x7ffc040387c8) = 0
munmap(0x7f2d742ba000, 20480)           = 0

I use PyTK for my Tea & Botany mod's Custom Machines. So, I temporarily took it out, & retested. AH was able to work without issues.
Digus does mention some possible compatibility issues with PyTK based mods that are modifying the mailbox & tv. But, mine only adds machines via CustomFarmingRedux.
So, I guess there's wider issues there.

As I don't normally play with Digus' AH mod, & I'm not really familiar with the deeper programming of the C#/.NET SMAPI mods.
I'll pass this along to Digus so he, & Platonymous can hash out exactly where their mods are conflicting; and find a proper resolution to this.
 

Mr_Jakob99

Farmhand
Hmm okay, do you think you can explain me how a strace log works? Because my game crashes quite randomly, relatively often. Sometimes on the first playing day, sometimes after the third... And it's really annoying to lose the whole day progress, especially with this many mods and the long loading times I have. And there is no log report, the game freezes for like two seconds and then everything is gone. Just like in the problem we discussed here, but without a clear reason. So maybe a strace log would help me too (or perhaps it even is PyTK with another problem).
Have you reported your log to PyTK?

Edit: I just tried to unisntall PyTK, but then realized, that way to many mods require it ... so deleting it is not an option for me
 
Last edited:
Yea, strace is a debugging tool to log system calls. The 'man' file has a lot more options you can use to optimize the output of the logging.
But, I just went with the basics.
strace -o log.txt ./StardewModdingAPI.bin.x86_64

Be warned that because of its low level logging; the output will be pretty large. With my 10ish mods. The output varied around 20-35MBs in size; over the couple logs I took.
I ended up opening them up in Geany as its my go-to for a lot of things; like very large savefiles, so it was able to open the log without issue.

From there, I started at the tail end of the file, and worked backwards though 'resource unavailable' & 'timed out' errors. But, you can also search for "smapi", and it should help narrow down things to where SMAPI would've logged.
----
Also, if you want to test it out on your end. You could always make a backup of your 'Mods' folder; and then replace it with a very trimmed down one that only holds the AH mod, MailFramework Mod dependency, and PyTK.
Then start a new save.
Run the following commands to give you the syringe & basket; then save:

Code:
player_addfeedingbasket
player_addinseminationsyringe
Then you can test between those 3 mods on your end.
 
Top