Why do I get 'Could not restart dynos at this moment. Please try again later.' errors when running CLI commands?

Issue

When you try running heroku ps:restart or heroku ps:scale commands via the CLI, you receive an error stating 'Could not restart dynos at this moment. Please try again later.'

Resolution

This error can occur when multiple dyno operations are happening concurrently. For example, if a dyno formation change is happening when you run heroku ps:restart you will likely receive this error. It's most commonly encountered by customers with larger dyno formations who are using auto-scalers that are frequently modifying the number of dynos running. You may encounter it with applications that have very large dyno formations even if you aren't using an auto-scaler though.

To avoid this issue, temporarily disable any auto-scaler you may be using before performing manual dyno restarts or scales. If that doesn't help or is not a possibility, the only option is to wait for a couple minutes and try again.