Claude code gets stuck frequently

claude code works for a few mins and then gets stuck while trying to type

system info:

Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 9 5950X 16-Core Processor
CPU family: 25
Model: 33
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
Stepping: 2
BogoMIPS: 6787.33

Node Info:

node version : v20.14.0
npm version : 10.7.0