I need help on Gardening Game

I am making a gardening game, and I have been trying to make an inventory system. I want to make it so you can only have one type of item in one inventory slot. But when i have been trying to make water go into my inventory slot it says, Program Error: Cannot read properties of undefined (reading ‘fields’). Here is the game https://arcade.makecode.com/S30901-49437-34092-71621

This is the fixed version BY CHATGPT

ok thanks