Bit late but I had the same issue and it was fixed by just removing Optifine. If it still occurs after that, try removing the fabric API and or sodium.