Cannot run more than 1 Free size dynos.

This is a common error when you forget or cancel a connection to heroku when using commands like:

heroku run rake db:migrate
bc(language-bash). heroku run  rails c --app you_app_name

Check your sessions

You will need to check if you have any sessions running with:

$ heroku ps --app your_app_name
=== web (Free): bundle exec puma -C config/puma.rb (1)
web.1: up 2017/06/13 10:23:38 +0800 (~ 33m ago)

=== worker (Free): bundle exec sidekiq -c 5 -q mailers -q default (1)
worker.1: up 2017/06/13 10:23:19 +0800 (~ 33m ago)

=== run: one-off processes (1)
run.2943 (Free): up 2017/06/13 10:39:57 +0800 (~ 17m ago): rails c

Stop the session

We will need to stop the session so that we can create a new session which we can use.

heroku ps:stop run.2943 --app your_app_name
Stopping run.2943 dyno on your_app_name... done

Try to run your session

$ heroku run rails c --app your_app_name
Running rails c on your_app_name... up, run.9284 (Free)
Loading staging environment (Rails 4.2.8)
[1] pry(main)>