HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

418 I'm a teapot

Fault: Neither
TL;DR

April Fools' joke from 1998 Hyper Text Coffee Pot Control Protocol.

The server refuses to brew coffee because it is, permanently, a teapot.

What This Error Means

The server refuses to brew coffee because it is, permanently, a teapot.

April Fools' joke from 1998 Hyper Text Coffee Pot Control Protocol.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Code Examples

Here's how to return a 418 status code in various programming languages:

Python (Flask)

from flask import Flask, jsonify

app = Flask(__name__)

@app.route('/endpoint')
def endpoint():
    return jsonify({"message": "I'm a teapot"}), 418

Node.js (Express)

const express = require('express');
const app = express();

app.get('/endpoint', (req, res) => {
    res.status(418).json({ message: 'I'm a teapot' });
});

PHP

<?php
http_response_code(418);
header('Content-Type: application/json');
echo json_encode(['message' => 'I'm a teapot']);
?>

Go

package main

import (
    "encoding/json"
    "net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(418)
    json.NewEncoder(w).Encode(map[string]string{
        "message": "I'm a teapot",
    })
}

Java (Spring Boot)

@GetMapping("/endpoint")
public ResponseEntity<Map<String, String>> endpoint() {
    Map<String, String> response = new HashMap<>();
    response.put("message", "I'm a teapot");
    return ResponseEntity.status(418).body(response);
}

Ruby (Sinatra)

get '/endpoint' do
    status 418
    json message: 'I'm a teapot'
end

Browser Compatibility

Browser Support Notes
Chrome✓ Full SupportAll versions
Firefox✓ Full SupportAll versions
Safari✓ Full SupportAll versions
Edge✓ Full SupportAll versions

Official Specification

This status code is defined in RFC 2324.

View on IANA HTTP Status Code Registry →