Could not find action with key "actions.home/index"

Hello,

I’ve been following along the guides for 2.3 and up until the home.index action generation everything works as per the guides. The action is also generated without errors and all the content is there as expected. However, after I generate the action and boot the app with `bundle exec hanami dev` I get this in the browser when visiting the root:

Puma caught this error: Could not find action with key "actions.home/index" in Books::App

To fix this, define the action class Books::Actions::Home::Index in app/actions/home/index.rb
 (Hanami::Routes::MissingActionError)
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice/routing/resolver.rb:83:in `ensure_action_in_slice'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice/routing/resolver.rb:66:in `resolve_slice_action'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice/routing/resolver.rb:41:in `call'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-router-2.3.0/lib/hanami/router.rb:860:in `resolve_endpoint'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-router-2.3.0/lib/hanami/router.rb:832:in `add_route'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-router-2.3.0/lib/hanami/router.rb:225:in `get'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-router-2.3.0/lib/hanami/router.rb:160:in `root'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/routes.rb:108:in `public_send'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/routes.rb:108:in `block (2 levels) in build_routes'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/routes.rb:104:in `each'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/routes.rb:104:in `block in build_routes'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-router-2.3.0/lib/hanami/router.rb:93:in `instance_eval'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-router-2.3.0/lib/hanami/router.rb:93:in `initialize'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice/router.rb:32:in `initialize'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:1045:in `new'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:1045:in `load_router'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:768:in `block in router'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:767:in `synchronize'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:767:in `router'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:786:in `rack_app'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/hanami-2.3.2/lib/hanami/slice.rb:805:in `call'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/configuration.rb:300:in `call'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/request.rb:101:in `block in handle_request'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/thread_pool.rb:355:in `with_force_shutdown'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/request.rb:100:in `handle_request'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/server.rb:503:in `process_client'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/server.rb:262:in `block in run'
/home/sebastjan/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/puma-7.1.0/lib/puma/thread_pool.rb:182:in `block in spawn_thread'

And this is from the console:

08:15:15 web.1    | 2025-12-16 08:15:15 +0100 Rack app ("GET /" - (127.0.0.1)): #<Hanami::Routes::MissingActionError:"Could not find action with key \"actions.home/index\" in Books::App\n\nTo fix this, define the action class Books::Actions::Home::Index in app/actions/home/index.rb\n">

I double checked all commands and the action was generate with bin/hanami. I don’t have any other steps for replication purposes.

What could be the issue?

It looks like your routes file might be wrong. If you’re talking about the very first step at V2.3: Building a web app | Hanami Guides, I’ve just replicated the steps as follows:

hanami new bookshelf_now
cd bookshelf_now
bin/hanami generate action home.index --skip-route --skip-tests

Then I edited config/routes.rb:

# frozen_string_literal: true

module BookshelfNow
  class Routes < Hanami::Routes
    root to: "home.index"
  end
end

After that, I can run bin/hanami dev and then curl http://localhost:2300 and I see my page:

<!-- spurious content snipped -->
<h1>BookshelfNow::Views::Home::Index</h1>

Given the error message you shared, I think you might be using a slash instead of a dot inside your routes:

root to: "home/index"

If you change that to:

root to: "home.index"

Then you should be good to go :slight_smile: Let us know!

Hi @timriley,

yes, it was the slash instead of the dot. I apologize for wasting everyone’s time.

No worries, @sebastjan_hribar! We’re here to help —thanks for trying Hanami!