daveslash 4 years ago

For those who may not know, this comes from RFC 2324: ""Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0), The RFC was published 1 April 1998 (April Fool's Day). There's a long history of humorous RFCs published on 1 April. For example, RFC 1149 "IP over Avian Carriers" https://en.wikipedia.org/wiki/IP_over_Avian_Carriers

List of Additional April Fool's RFCs https://en.wikipedia.org/wiki/April_Fools%27_Day_Request_for...

  • Teknoman117 4 years ago

    I still love that people actually went through the effort to "implement" it.

    • mzzter 4 years ago

      Any links to APIs that implement a 418 HTTP response code?

      • madamelic 4 years ago

        If I have anything to do with it, there is a 418 response hidden somewhere.

        I recall a few internal projects at a previous employer would return 418 if the user managed to royally mess something up as a "wtf, how are you here?!" kind of response.

        I feel like I am not alone in implementing 'weird' HTTP codes when I get bored / as an easter egg. Pretty sure I also used HTTP 420 at least once.

        • flatiron 4 years ago

          “Uhh ummm no” -code reviewer

          • codr7 4 years ago

            Yeah, code reviews definitely killed some of the fun in coding, they are rarely performed with humor.

            • rockwotj 4 years ago

              I generally make it a goal to have a test case with silly enough data to get a comment from a reviewer.

              • KineticLensman 4 years ago

                I remember reviewing a really long document (> 50 pages) that had in one bullet list the phrase 'Marks and Spencer tandoori chicken sandwich'. The doc was otherwise camera ready and the phrase was obviously there to see if I was in fact reading it

        • jylauril 4 years ago

          Ah, the good ol' 420 - EnhanceYourCalm

      • tbronchain 4 years ago

        Binance API (i.e https://api.binance.com/api/v3/ticker/price) does it when there are too many requests from one IP (I assume that's the reason). They could have used something else like 429 but for some obscur reasons they're using 418 (if anyone knows the actual reason...).

        It will happen often if you try to make a call to their API through Google sheet scripts.

      • pkd 4 years ago

        No link but our internal API for mobile apps returns a 418 if the installed version is too old.

      • lallysingh 4 years ago

        If you have an IoT teapot, when do you return it?

        • TobTobXX 4 years ago

          From the docs:

          > ... indicates that the server refuses to brew coffee because it is, permanently, a teapot.

          So I guess, when it is asked to perform coffee brewing? But pay close attention, to your general purpose brewer:

          > A combined coffee/tea pot that is temporarily out of coffee should instead return 503.

      • spc476 4 years ago

        I added the 418 response code to my gopher server [1]. There was one web bot that constantly hit it and was clueless that it wasn't a web server. It finally got a clue.

        [1] https://github.com/spc476/port70

      • claviska 4 years ago

        I sometimes return a 418 when request heuristics detect bad behavior that looks intentional. I don’t document it, though.

  • SilasX 4 years ago

    To toot my own horn, I did an April Fool’s status code RFC: 397 Tolerating, for when a client sends a flawed request, but you’re going to tolerate it because you know what they really meant:

    https://pastebin.com/TPj9RwuZ

    • xwdv 4 years ago

      This is a good idea for APIs that allow you to update an object by sending a partial JSON object with the keys you want to update, when technically you’re supposed to send the entire updated object representation unless JSON Patch is being used.

      • munk-a 4 years ago

        Alternatively there actually is a HTTP PATCH verb that you can use for this - I think that tolerating is more appropriate for common misspellinks - i.e. accepting a request like an HTTP POST {"days": 12, "horus": 13 "minutes": 27}

        • aidenn0 4 years ago

          But what happens when the API is updated to support Egyptian gods as keys?

          • IIAOPSW 4 years ago

            You submit a scarab report.

    • jfrunyon 4 years ago

      April Fools RFCs are part of the "Independent Stream", which mean the top left would say "Independent Submission", not IETF. Also, Informational, not Standards Track. Just FYI :)

    • eyelidlessness 4 years ago

      Is this basically "I'm doing the robustness principle but also communicating that I'm judging you"?

      • SilasX 4 years ago

        lol Pretty much! It cites the Robustness Principle.

        • eyelidlessness 4 years ago

          That’s what I get for responding while eating dinner and not reading thoroughly lol

      • hakfoo 4 years ago

        I love the concept.

        At the firm I work at, one of my "10% time" projects was to build out a "warnings" field in the API response. There are often times that you want to say "this is not inherently wrong, but likely represents wrong assumptions upstream" or "you're asking for something that's obsolete and is now being silently ignored".

        For example, if someone passes a currency field with the wrong number of decimal places. You might actually want to say your product costs $1.62346, but it's more likely you're not sanitizing your data and relying on non-guaranteed rounding behaviour to make it right.

        The problem we have is that the most of the API fields are opt-in-- the people who could most use the warnings are unlikely to go in and activate them.

        • eyelidlessness 4 years ago

          To be honest I think the robustness principle isn’t very well supported. We shouldn’t be this accommodating in what we accept. We’re very likely harming users by ignoring errors.

          • eyelidlessness 4 years ago

            That said we should be much more accommodating in our user interfaces to help prevent this kind of crap data.

samschooler 4 years ago

Some previous discussions on this status specifically: https://hn.algolia.com/?q=418

Some fun ones:

- Discussion on the status itself: https://news.ycombinator.com/item?id=24206899

- NPM proxy users receiving ERR 418 I'm a teapot: https://news.ycombinator.com/item?id=17175960

- Reserve the 418 status code: https://news.ycombinator.com/item?id=15004907

lordalch 4 years ago

I'm personally of the opinion that 418 shouldn't be considered a joke response, but would actually useful as 418 "Unsupported Device".

What response should a printer give if you asked it to send a fax, but you have a base-model printer that doesn't support sending faxes. From the perspective of the printer, I know what you want (i.e. not a 404) and you've asked for it correctly (i.e. not 400 or 401 or 403), but I can't do it, and this does not indicate an error on my part (not a 500 or 503). Thus, 418: Unsupported Device.

Perhaps this too much of an overlap with 404 (I don't have that resource) and 501 (I can't do that verb to that resource), which I assume is why there's not a huge need for it. But if we're going to have 418 exist and receive browser support anyway, it might as well have a useful meaning rather than just exist as a joke.

This interpretation is fully in keeping with the non-joke meaning of the original RFC, as a teapot is a device that does not support brewing coffee.

  • Nashooo 4 years ago

    It's complete overlap with 404 IMO

    • hnarn 4 years ago

      If you throw a 404 to a completely valid GET for a file that doesn't exist for example, how is that a "complete overlap" to something like asking a database REST API to print a PDF? In the latter case, you have the ability to give a more detailed (better) error message, so why shouldn't you?

  • jlund-molfese 4 years ago

    I'd probably use a 422 in that case. I think 422 errors are underused, and can good for communicating errors when a client requests something which doesn't make sense from a business context.

    • hnarn 4 years ago

      For those that haven't memorized every single HTTP error code, 422 is "Unprocessable Entity": 'the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.'

duxup 4 years ago

I return 418 in some cases where somehow someone ended up somewhere in the code that I otherwise thought impossible. It works pretty well as far as letting folks know that something particularly unusual has happened / this isn't your ordinary error.

  • _jal 4 years ago

    A less humorous unusual status code is 451. Unfortunately, it probably should be used more.

    https://en.wikipedia.org/wiki/HTTP_451

    • duxup 4 years ago

      I think that would get attention, although I wouldn't want there to be panic ;)

    • norrius 4 years ago

      I come from a country with rather _interesting_ views on what should be allowed online. 451 is used often enough that I've seen it in the wild more than once (and consider yourself lucky if you haven't encountered it...).

      • mrweasel 4 years ago

        I get those every so often from US websites that doesn't want to deal with the GDPR.

        • da_chicken 4 years ago

          That suggests that there are websites anywhere that do want to deal with GDPR, which seems rather unlikely.

          • Doxin 4 years ago

            Of course there's a lot of people who would prefer to ignore laws. That doesn't make GDPR an especially bad one.

  • LorenPechtel 4 years ago

    Except a 4xx error should not be issued for internal errors.

    • JoyrexJ9 4 years ago

      I do hope this is a humorous comment

      • OJFord 4 years ago

        Why? The codes mean things, 418 specifically is a joke, but the entire 4xx range are client errors, i.e. a differently formed request would've succeeded.

        A perhaps-reasonable suggestion could be to use a 5xx range code that isn't specified. E.g. 555, or 567.

        (But I'm not sure how it would ever not simply be a 500 - server thought it couldn't happen, it could and did, that's just a plain and simple error isn't it?)

        • Izkata 4 years ago

          I think the idea behind 418, as much as there was an idea beyond a joke, was to indicate you sent your request to a teapot instead of a server. So yeah, client error for why it's not 518 instead.

          But it works in this example for "client did something weird I don't understand", so still client error - something akin to a 404, "client tried to go somewhere I don't understand".

          • OJFord 4 years ago

            Yes, exactly, I wasn't excluding 418 in saying all 4xx are errors in the client's request.

            But 'client did something weird I don't understand' is a 400, 405, something; not the same as 'this cannot happen' at all.

            • mekkkkkk 4 years ago

              But it's the clients fault for trying to communicate with a teapot. There's nothing wrong inside the teapot. You just tried to communicate with a teapot. That's silly. Here's a 418 for you.

              • OJFord 4 years ago

                Again, yes, I am not saying 418 is wrong to be 4xx, I am including it in 'the entire 4xx range are client errors'.

        • perilunar 4 years ago

          I would be extremely disappointed if a 555 error didn't have something to do with bad timing.

      • IncRnd 4 years ago

        400 series codes are for client errors. 500 series codes are for server errors.

kzrdude 4 years ago

It's quaint, it's a joke about IoT devices before they were everywhere. I'm currently disappointed that the office has "upgraded" coffee machines and the new one has a permanent internet connection and shows ads/branding (for coffee) when it is idle.

  • jimmaswell 4 years ago

    I read a while ago about some coffee machines unintentionally bridging an internal network and spreading ransomware. I think they had Windows XP on the inside. Couldn't help but find the situation funny in a way.

    • treeman79 4 years ago

      Good old XP.

      Cleaned someone’s virus infected computer out. Plugged the network jack into the cable modem. Under 10 second and I had to start from scratch…

      When work tells us they are blocking all external connections in data center, I can’t really argue even with how much work it is.

  • ableal 4 years ago

    A couple of years ago the gas pumps at station nearest to my place were replaced by devices with screens that play ads with sound - so far just touting discounts with their supermarket loyalty cards. They start when someone picks up the nozzle, and were annoyingly loud initially; the sound has been turned down a bit lately.

    (Well, there's another reason for me to be pleased with having traded one of the family cars for an electric that charges at home ...)

    • snowwrestler 4 years ago

      There are usually buttons next to pump screens and one will mute the sound. Just push them one by one.

      • arbitrage 4 years ago

        the manufacturers caught on to that specific mitigation, and it doesn't work that often in the wild anymore.

        • bombcar 4 years ago

          Ours have it prominently marked MUTE ->

    • technothrasher 4 years ago

      There are a few gas stations around here with pumps that like to play ads at you while pumping gas. I tend to make a note of them and purposely get my gas elsewhere.

  • xjlin0 4 years ago

    So, if the server were a real "smart" IoT teapot, such response become actually valid? :)

    • IggleSniggle 4 years ago

      Well, this is an error code, so yes but- only if someone asks the teapot to brew a cup of coffee. Per the spec.

    • IIAOPSW 4 years ago

      One day in the future, people will be amazed out how forward thinking our society was circa 1999 when they planned status codes for IoT devices that wouldn't be invented for another 20 years. "Oh if only society now could be as wise forward thinking as people were back then. Planting seeds in gardens they'd never get to see."

  • SV_BubbleTime 4 years ago

    >and shows ads/branding (for coffee) when it is idle.

    If there is ever an Office Space 2, I think this is a candidate for the new fax machine.

    • yakshaving_jgt 4 years ago

      I think for the same reason that Fawlty Towers ended after one season, there should never be a sequel to Office Space.

      It’s too perfect. It could only go downhill.

      • frutiger 4 years ago

        Fawlty Towers ran for two series, but your point remains.

        • squarefoot 4 years ago

          Agreed on principle, although in the last 2 years there's enough material for a highly successful Idiocracy sequel. Probably a short series too.

      • pengaru 4 years ago

        No, there must be a sequel; Open Office Space.

        Office Space is great but the cubicles date it firmly in the 90s.

        • dylan604 4 years ago

          Office Space 2 => Open Office Space => Silicon Valley

        • jsjohnst 4 years ago

          > Office Space is great but the cubicles date it firmly in the 90s.

          I had a cubicle almost identical to the ones in Office Space all the way up to 2011. If I ever had to return to an office, I’d much prefer that over any office desk I’ve had since.

  • ufmace 4 years ago

    Do you mean ads in the sense of "please buy brand X coffee" or in the sense of "please try some of this machine's delicious coffee"?

    • kzrdude 4 years ago

      just stuff that emphasizes the brand of coffee that's in the machine. It's ridiculous (obviously an ad to buy that brand at home too, which I safely won't since I like my specialty coffee).

      We need coffee machines that shut up and serve coffee and don't do brand ads.

      • xwdv 4 years ago

        If only such a coffee machine still existed.

  • dylan604 4 years ago

    Sounds like it needs to be playing Doom instead. Or hacked to show branding for tea.

kevwil 4 years ago

I guess it's been about a generation since I implemented this as an easter-egg in a RESTful API service I built. It was quite the joke then, but now with IoT "smart" teapots and whatnot being so popular, it's not so funny now.

  • vincentpants 4 years ago

    Came to mention this. It really was a fantastic joke. May it rest in peace. pours one out

J5892 4 years ago

Would it be valid for an actual IoT teapot to return this instead of a 200 for a valid request?

  • remedan 4 years ago

    It's an error code. It should be returned by a tea pot as a response to a request for coffee.

andrethegiant 4 years ago

My favorite part is that the response body can optionally include "short and stout".

enahs-sf 4 years ago

Reminds me of the twitter "Enhance Your Calm" 420 status code in lieu of 429.

stblack 4 years ago

Support for this landed in Microsoft Edge v12, according to the table in the article. So it's supported across all major browsers, green across the board. But all that may be humorous lisense.

  • hirsin 4 years ago

    Hm, that's surprising. I added it as a known error response to the Internet Explorer dev tools in 2015 (inadvertently causing "I'm a teapot" to be localized into 108 languages...). I wonder what "support" means.

schnable 4 years ago

It's all fun and games until some clever developer uses this error code in a production system and the client developer or SRE folks have no idea what it means. Have also seen error code 420 used this way.

  • spc476 4 years ago

    I was counting on that when I added status 418 to my gopher server. It shut a particular web bot right up when I did that.

jonwinstanley 4 years ago

Nice to see more members of the community discovering a classic. Also... I am so old I've seen this on the homepage multiple times :-(

  • exdsq 4 years ago

    I’m in my late twenties and I’ve seen it dozens of time too

    • jonwinstanley 4 years ago

      Haha yes it keeps going round and round

paulkrush 4 years ago

There is a "418 – I'm a teapot" book too (by Edgar Scott). I highly recommend it for dystopian hard sci-fi lovers.

whckt 4 years ago

A fun one I found out a while back is that Twitter used 420 Enhance Your Calm instead of 429 Too Many Requests to rate limit.

artembugara 4 years ago

I've heard it's been used a lot by the MOVA developers

coding123 4 years ago

I can't remember but didn't some company try to implement this for an actual connected tea pot?

rspoerri 4 years ago

i wonder how this is handled in vr browsers?