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

**Code:** `ActionController::UnknownFormat` · **Category:** Ruby / Rails · **Seen on:** Ruby

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rails-unknown-format)
