There are a whole slew or GE washers that have the intermittent spin problems. It’s a known software bug. We were plagued for a year throwing parts at the washer only to have a senior tech show up with a software box and a smart phone clear the errors flash the firmware update and boom works every time.
If yours is a GE check the model numbers vs this listing and year of manufacture for the OEM software build number.
https://partsdr.com/blog/ge-top-load-washer-intermittently-spin-up-wet-loads-not-spinning/
Not a GE but a Whirlpool. Good to know what the problem might be.