“No space left on device” with plenty of free gigabytes is confusing until you look at inodes.
df -i /var
df -h /var
Every file uses one inode, and on ext4 the number of inodes is fixed when the filesystem is made. A directory full of millions of tiny files, such as session or cache files, can use them all while df -h still shows free space. If IUse% is at 100%, delete the small files. XFS and Btrfs allocate inodes dynamically, so the problem is mostly an ext4 one.
Further reading: df manual page