What this thread does
The problem
A Rails app stops on migrations, cannot load a constant, rejects forms or cannot find CSS. Match the exception before changing configuration. These four documented families are relevant to Rails 8.x; a 2026 frequency ranking is unverified.
Versions and status, checked 2026-10-20
| Component | Official reference fetched today | Scope |
|---|---|---|
| Rails | 8.1.4, released 2026-09-24, per the announcement | Reference release; inspect the app's lockfile |
| Rails licence | MIT in the release licence | No hosted pricing asserted |
| Asset pipeline | Rails 8.0 release notes make Propshaft the default | Upgraded apps may retain Sprockets |
Run bundle exec rails --version; inspect Gemfile.lock for the actual asset stack.
Which branch?
| Symptom | First check | Repair target |
|---|---|---|
| PendingMigrationError | Environment and migration status | Reviewed pending migrations |
| Zeitwerk::NameError | File path versus constant | Naming, namespace or inflection |
| InvalidAuthenticityToken | Token, cookie and origin | Session/token flow |
| Propshaft::MissingAssetError | Filename, load path and output | Built asset visibility |
1. ActiveRecord::PendingMigrationError
Exact message opening Migrations are pending. To resolve this issue, run: appears in Rails 8.1.4 source (checked 2026-10-20). The command, environment and pending files follow.
The selected environment has unapplied migrations. Confirm the intended database without printing connection secrets. On an approved local development database, inspect status, review pending files, apply them and recheck.
RAILS_ENV=development bin/rails db:migrate:status
RAILS_ENV=development bin/rails db:migrate
RAILS_ENV=development bin/rails db:migrate:status
Production migrations need a reviewed deployment step. See the migration guide (checked 2026-10-20). Do not reset/drop the database, delete migration history, disable pending checks or rewrite a shared applied migration.
2. Zeitwerk::NameError
Exact check output in the official HOWTO (checked 2026-10-20).
expected file app/models/vat.rb to define constant Vat
This is check output. The Zeitwerk README confirms managed files missing their expected constant raise Zeitwerk::NameError (checked 2026-10-20).
Paths map to constants relative to autoload roots. Inspect spelling, namespace and acronyms; rename the file or constant to match the intended API. For intentional VAT, the guide's narrow initializer override is Rails.autoloaders.main.inflector.inflect("vat" => "VAT"). Recheck after each repair.
bin/rails zeitwerk:check
Do not scatter require calls, switch to the classic autoloader or suppress errors. Review custom roots before global inflection changes. Plain initializer-time NameError can have another cause.
3. ActionController::InvalidAuthenticityToken
That exact exception class appears in the security guide (checked 2026-10-20). It identifies a rejected forgery check, not whether token, session or origin failed; no universal suffix is asserted.
For cookie-authenticated HTML, retain <%= csrf_meta_tags %> and Rails-generated forms. Custom same-origin JavaScript must send the current page token in X-CSRF-Token with the session cookie. Check their presence and request origin in browser network tools without copying token values into reports. Locate relevant code locally.
rg -n 'csrf_meta_tags|form_with|X-CSRF-Token|protect_from_forgery' app
Restore missing meta tags or header/cookie flow; reload after session changes. Verify one form GET and POST in the same session with forgery checks enabled. For logged proxy-origin mismatches, check forwarded scheme and canonical host. Do not globally skip verification, disable origin checks or hard-code tokens. APIs/webhooks need their own authentication design.
4. Propshaft::MissingAssetError
Exact observed example Propshaft::MissingAssetError (The asset 'active_admin.css' was not found in the load path.) appears in krtschmr's Active Admin report (checked 2026-10-20). Propshaft's helper raises when resolution fails (checked 2026-10-20).
Inspect the helper's logical filename, load paths and generated output. Propshaft does not replace a Sass/JavaScript compiler.
rg -n 'stylesheet_link_tag|javascript_include_tag|assets.paths|assets.excluded_paths' app config
rg --files app/assets vendor/assets
Missing directories are diagnostic. Use the existing bin/dev if the project configures bundler watchers; otherwise run its declared build task. Match the helper to the output filename. In an isolated deployment build, the asset guide documents this command (checked 2026-10-20).
RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 bin/rails assets:precompile
Include generated assets in deployment. For stale development precompiles only, bin/rails assets:clobber removes generated assets/manifest; restart the development build. Do not clobber live deployment assets, create empty CSS to hide missing builds or install Sprockets just because an old tutorial uses it.
What the community says
- Blaine Lafreniere's Rails forum question contains a real expected-constant exception. Zeitwerk author Xavier Noria asks whether all of
libneeds autoloading and points to naming conventions. Older demand is not proof of a Rails 8 regression (checked 2026-10-20). - ron-shinall, Rails #46147 reports a different initializer-time failure. Maintainer Xavier Noria explains the reloadable-constant restriction; the author confirms
to_preparefixed that case. This bounds the filename advice (checked 2026-10-20). - krtschmr, Active Admin #8538 shows missing CSS in an early Rails 8.1 setup, not a verified fix for today's gem combination.
A prompt to give your agent
Read the linked official source for the exact exception before recommending changes; do not guess messages, gem versions or migrations. Identify the installed stack, environment and first relevant trace. Propose one repair and verification command. Keep tokens/connection secrets out of output. Reproduce in a disposable local app/database; do not run production migrations or disable CSRF checks.
Limits
No Rails app, migration, request, asset build or regression test was run. Community evidence is largely older than 2026, sometimes on earlier Rails; 2026 frequency is unverified. Unverified strings include a universal combined ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity) line, generic asset pipeline error and reader-specific Zeitwerk paths/constants. None is asserted as a universal exact message. Separate Propshaft/Zeitwerk patch versions, current Active Admin compatibility and proxy-specific fixes remain unverified. The edge HOWTO supplies naming diagnostics, not a Rails 8 autoloader migration requirement.
Started from a post by @ron-shinall, packaged by the editor. Original post