Heroku: Cannot run more than 1 Free size dynos

Ruby on-RailsHerokuHeroku Toolbelt

Ruby on-Rails Problem Overview


I was trying to run

heroku run rake db:migrate

And was getting the error

> Cannot run more than 1 Free size dynos.

See below for how to fix...

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

Most Efective

in console run:

heroku ps

the result is some like this:

run.4859 (Free): up 2016/01/12 21:28:41 (~ 7m ago): rails c

So the numbers 4859 represent the session that is open and needs to be closed. To fix the error you need to run(Obviusly, replace the number 4859 by the number obtained):

heroku ps:stop run.4859

It is a very simple solution.

Solution 2 - Ruby on-Rails

The answer is to look for any open heroku sessions (you can use 'heroku ps' as john points out above), in my case I already had a started a heroku console session 30mins earlier and just forgot about it. So if you see the "Cannot run more than 1 Free size dynos" error just close any existing console or other heroku sessions you have open.

Hopefully this saves someone the ten minutes it took me to come to my senses.

Solution 3 - Ruby on-Rails

Had the exact same issue and came to this page. After reading realized what was going on but want to add following.

just run

heroku kill DYNO --app your_app_name

After this close all open consoles.

Then run db migrate command, it will work.

Solution 4 - Ruby on-Rails

In my case, I ran heroku ps:restart to restart all dynos and the heroku run * command worked again.

Examples

If you just have one Git remote for Heroku, use this:

heroku ps:restart && heroku run *

If you have multiple Git remotes for Heroku, use this:

heroku ps:restart --remote your-remote-name && heroku run * --remote your-remote-name

OR

heroku ps:restart --app your-heroku-app-name && heroku run * --app your-heroku-app-name

Replace * with your command e.g. console for Rails console.


What I meant by your-heroku-app-name here is the sub-domain for your Heroku app. For example, if your app URL is https://cute-cat.herokuapp.com, that means your-heroku-app-name is cute-cat.

If you are not sure/forgot what's your Git remote name for Heroku, git remote -v can help you with that.

Example:

$ git remote -v
this-is-the-remote-name	     https://git.heroku.com/xxx.git (fetch)
this-is-the-remote-name	     https://git.heroku.com/xxx.git (push)
this-is-another-remote-name	 https://git.heroku.com/yyy.git (fetch)
this-is-another-remote-name	 https://git.heroku.com/yyy.git (push)

Solution 5 - Ruby on-Rails

Just restart all dynos. heroku restart

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrewView Question on Stackoverflow
Solution 1 - Ruby on-Railsuomo_perfettoView Answer on Stackoverflow
Solution 2 - Ruby on-RailsAndrewView Answer on Stackoverflow
Solution 3 - Ruby on-RailsManasView Answer on Stackoverflow
Solution 4 - Ruby on-RailsZulhilmi ZainudinView Answer on Stackoverflow
Solution 5 - Ruby on-RailsMicahView Answer on Stackoverflow