ActionController::UnknownFormat Ruby / Rails Origin: Application & API Last updated 5 Nov 2026

Rails: ActionController::UnknownFormat — UsersController#show is missing a template for this request format and variant

The controller has no template or respond_to handler for the requested format (HTML/JSON/etc.).

Exact message you may see ActionController::UnknownFormat in UsersController#showUsersController#show is missing a template for this request format and variantActionController::UnknownFormat (ActionController::UnknownFormat)missing a template for this request format and variant
Seen on: Ruby

Meaning

Add the template (show.html.erb/show.json.jbuilder), or handle the format in respond_to. Often a browser hits a JSON-only action, an API client sends Accept: */* incorrectly, or a Turbo request needs turbo_stream. Check the Accept header and the URL extension.

Common causes

  • Missing template for the format
  • JSON endpoint requested as HTML (or reverse)
  • respond_to lacking the format
  • Turbo/Hotwire turbo_stream template missing
  • Wrong Accept header

⚡ Quick fix

  1. Add show.json.jbuilder or render json:
  2. Use respond_to do |format| format.html; format.json { render json: @user } end
  3. Send Accept: application/json

Detailed fix by platform

Rails

  1. curl -H "Accept: application/json" http://localhost:3000/users/1.json

How to diagnose

  1. Format — Requested?
  2. Template — Exists?
  3. respond_to — Handles it?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

AbstractController::DoubleRenderError — Rails: AbstractController::DoubleRenderError (Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action) (Ruby / Rails)AbstractController::D…ActionController::ParameterMissing: param is missing or the value is empty — Rails: ActionController::ParameterMissing: param is missing or the value is empty: user (Ruby / Rails)ActionController::Par…ActionView::MissingTemplate: Missing template — Rails: ActionView::MissingTemplate (Missing template users/show, application/show with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder]}) (Ruby / Rails)ActionView::MissingTe…ActiveRecord::AssociationTypeMismatch — Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678) (Ruby / Rails)ActiveRecord::Associa…ActiveRecord::ConnectionNotEstablished — Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found (Ruby / Rails)ActiveRecord::Connect…ActiveRecord::Deadlocked: PG::TRDeadlockDetected — Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected (Ruby / Rails)ActiveRecord::Deadloc…ActiveRecord::IrreversibleMigration — Rails: ActiveRecord::IrreversibleMigration — This migration uses remove_column without a type; db:rollback can't reverse it (Ruby / Rails)ActiveRecord::Irrever…ActionCon…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.