Skip to content
Latchkey

Rails "ActionController::RoutingError: No route matches" in CI

Rails could not match the requested path to any route. When this happens only in CI, the test environment is missing a route that exists in development, often an engine mount, an asset path, or a route guarded by an environment condition.

What this error means

A request or system test fails with "ActionController::RoutingError: No route matches [GET] \"/path\"" that passes locally.

Rails
ActionController::RoutingError:
No route matches [GET] "/rails/active_storage/blobs/redirect/..."

Common causes

A route is conditional on the environment

Routes wrapped in if Rails.env.development? (or mounted only outside test) are absent when the suite runs under test.

A dependent engine or asset route is not loaded

Active Storage, an engine, or an asset route was not mounted or compiled in CI, so the path has no match.

How to fix it

Mount the route for the test environment

  1. Confirm which path the error names and where it is defined.
  2. Remove or widen an environment guard so the route exists in test.
  3. For asset paths, ensure assets are precompiled so their routes resolve.
config/routes.rb
# config/routes.rb - mount the engine in all environments
mount Sidekiq::Web => "/sidekiq"

Inspect routes in CI

List the routes the test environment actually loads to see what is missing.

Terminal
RAILS_ENV=test bin/rails routes | grep active_storage

How to prevent it

  • Avoid environment-conditional routes that tests depend on.
  • Precompile assets so asset routes resolve in CI.
  • Run bin/rails routes to diff development vs test route tables.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →