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.).
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 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_tolacking the format- Turbo/Hotwire turbo_stream template missing
- Wrong
Acceptheader
⚡ Quick fix
- Add
show.json.jbuilderorrender json: - Use
respond_to do |format| format.html; format.json { render json: @user } end - Send
Accept: application/json
Detailed fix by platform
Rails
curl -H "Accept: application/json" http://localhost:3000/users/1.json
How to diagnose
- Format — Requested?
- Template — Exists?
- 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:
Similar errors
- 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)
- ActionController::ParameterMissing: param is missing or the value is empty Rails: ActionController::ParameterMissing: param is missing or the value is empty: user
- ActionView::MissingTemplate: Missing template Rails: ActionView::MissingTemplate (Missing template users/show, application/show with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder]})
Most viewed in Ruby / Rails
- ActiveRecord::PendingMigrationError Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate
- undefined method for nil Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)
- ActionController::InvalidAuthenticityToken Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 5 Nov 2026