"No more processes (11)" when repeatedly calling get_accel() on IMU.

I am getting the errno 11 when calling inertial->get_accel() where inertial is defined as std::make_shared<pros::IMU>(INERTIAL_PORT)

Code around:

  // get accel
  auto accel = inertial->get_accel();

  if (errno != 0) {
    printf("Error: %s (%d)", strerror(errno), errno);
    return;
  }

This is running in a task that is defined as:

void updatePositionLoop() {
  while (true) {
    updatePosition();
    pros::Task::delay(10);
  }
}

[...]

// in void initialize
pros::Task updateTask(movement::updatePositionLoop)

The issue is similar to this issue from 2 years ago.
Everything works fine for a few seconds, and then it breaks.