[Question]
  [
**Challenge**
Write the shortest program that, when compiled or executed, produces a fatal error message smaller than the program itself. The error message may not be generated by the program itself, such as Python's `raise`. A valid answer must include both the code and the error message. Shortest valid answer wins.
No error message does not count as an error message.
**Example (Lua)**
Code (46 bytes): 
```
[
--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```
Error (45 bytes):
```
[string "[..."]:1: unexpected symbol near '['
```
  
[Answer]
# [ed](https://www.gnu.org/fun/jokes/ed-msg.html), 3 bytes
*Note: Most of the answers here are ignoring the trailing newline printed as part of the error message in their count. But I don‚Äôt see anything in the question to justify ignoring it, and the author [commented that the newline should be included](https://codegolf.stackexchange.com/questions/133840/shortest-error-message?answertab=votes#comment328883_133840). So unless the question is changed, I‚Äôm going to include it.*
Code (with trailing newline):
```
??
```
Error (with trailing newline):
```
?
```
[Answer]
# C (modern Linux), 19 bytes
Would've done my famous segfault but totallyhuman stole it.
```
main(){longjmp(0);}
```
Output (18 bytes):
```
Segmentation fault
```
[Answer]
# Python 2, 35 bytes
```
import sys;sys.tracebacklimit=000;a
```
Gives error:
```
NameError: name 'a' is not defined
```
[Answer]
## JavaScript (Firefox), 31 bytes
```
# This is a comment, right? ...
```
Throws this error:
```
SyntaxError: illegal character
```
Tested in the console of Firefox 54.0.1 on Windows 7.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~87~~ 79 bytes
*-8 bytes thanks to Zachar√Ω and Erik the Outgolfer.*
```
from __future__ import braces
#i am most surely seriously actually totallyhuman
```
[Try it online!](https://tio.run/##FclLCsAgDADRfU8R6A16oZCKomCM5LPw9Nau5sHM5VXGs3dRYUAs4aEZERpPUYdXKWW77gbEwGIOdn5fYFmbhB1R8qB@4OJ/azCNvT8 "Python 2 ‚Äì Try It Online")
## Error message, 78 bytes:
Assuming the code is stored in a file named `a`.
```
  File "a", line 1
    from __future__ import braces
SyntaxError: not a chance
```
This is actually a nice little Easter egg in Python. :D
[Answer]
# Haskell, 13 bytes
```
main = (main)
```
Save as `t.hs` or another one-character name, compile with `ghc`, and run. Error message (with trailing newline):
```
t: <<loop>>
```
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 26 bytes
```
>>>>>>>>>>>>>>>>>>>>>>>>>:
```
[Try it online!](https://tio.run/##S8sszvj/3w4XsPr/HwA "><> ‚Äì Try It Online")
Every error message in Fish is `something smells fishy...`, so this just moves the pointer right enough times to be longer than that and attempts to duplicate the top of the stack, which is empty at the time.
[Answer]
# [Taxi](https://bigzaphod.github.io/Taxi/), ~~38~~ 21 bytes
```
Switch to plan "abc".
```
Produces:
```
error: no such label
```
[Try it online!](https://tio.run/##K0msyPz/P7g8syQ5Q6EkX6EgJzFPQSkxKVlJ7/9/AA "Taxi ‚Äì Try It Online")
*-17 bytes thanks to Engineer Toast*
Tries to switch to "abc", which does not exist. You would have `[abc]` somewhere.
[Answer]
## JavaScript (Firefox), 21 bytes
```
(a=null)=>a.charAt(1)
```
**Error (20 bytes)**: `TypeError: a is null`
[Answer]
# System V shell, 25 bytes
```
mount /dev/hda1 /mnt/hda1
```
Error message (23 bytes):
```
mount: not a typewriter
```
"Not a typewriter" or `ENOTTY` is an error code defined in `errno.h` on Unix systems. This is used to indicate that an invalid ioctl (input/output control) number was specified in an ioctl system call. On my system, in `/usr/include/asm-generic/errno-base.h`, I can find this line:
```
#define ENOTTY          25      /* Not a typewriter */
```
In Version 6 UNIX and older, I/O was limited to serial-connected terminal devices, such as a teletype (TTY). These were usually managed through the `gtty` and `stty` system calls. If one were to try to use either of these system calls on a non-terminal device, `ENOTTY` was generated.
Nowadays, there is naturally no need to use a teletype. When `gtty` and `stty` were replaced with `ioctl`, `ENOTTY` was kept. Some systems still display this message; but most say "inappropriate ioctl for device" instead.
[Answer]
# [TrumpScript](https://github.com/samshadwell/TrumpScript), 30 bytes
```
We love NATO!
America is great
```
Error message:
```
Trump doesn't want to hear it
```
[Answer]
# **Javascript (V8), 24 bytes**
```
decodeURIComponent('%');
```
Error, 23 bytes:
```
URIError: URI malformed
```
Tested on *Nodejs v6.11.0* and *Google Chrome v59.0.3071.115*.
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/f8/JTUZSIcGeTrn5xbk56XmlWioq6prWv//DwA "JavaScript (Node.js) ‚Äì Try It Online")
Note that TIO expands the error message.
[Answer]
# QBasic, 11 bytes
There are two solutions of 11 bytes in QBasic, one of which might be golfed further. The shortest error message QBasic has is `overflow`, and can be triggered as such:
```
i%=i%+32677
```
This throws `overflow` because the max for an integer (`i%`) is `32676`. I couldn't get the `32677` golfed without QBasic auto-casting this to long...
Another error, at 11 bytes, would be `out of data`. QBasic has `DATA` statements that store data in the program, which can later be accessed by `READ` statements. Issuing more `READ`s than `DATA`s causes the error:
```
READ a$ '--
```
Note that the statement is padded with a comment to get it up to the length of the error message. Yes, I have an error message with a shorter program, and a program with a shorter error message ...
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 309 bytes
```
In this answer, I coded it so that the program errors when executed‚Ä§
Also, according to code-golf statistics, only a small percentage of people who view my answers actually upvote‚Ä§ 
So if you enjoy this answer, please consider upvoting - it's free, and you can change your mind at any time‚Ä§ 
Enjoy the answer‚Ä§
```
I request that you imagine [Epic Dawn](https://www.youtube.com/watch?v=beCC9xJjLZQ) by Bobby Cole is playing while reading this answer.
## The Error
```
Traceback (most recent call last):
  File "C:\Users\61419\Desktop\Vyxal\Vyxal.py", line 867, in <module>
    exec(line)
  File "<string>", line 4, in <module>
  File "C:\Users\61419\Desktop\Vyxal\Vyxal.py", line 592, in VY_int
    return int(item, base)
ValueError: invalid literal for int() with base 10: ''
```
# Explained
This fails immediately on the first instruction it sees: `I`. It tries to convert the empty input to base 10 (which is impossible)
[Answer]
# C (Modern Linux), 19 bytes
I suggested this in chat, but nobody took the oppurtunity. :P Credit to [MD XF's hilarious answer](https://codegolf.stackexchange.com/a/121264/).
```
main(){puts('s');;}
```
## Error message, 18 bytes
```
Segmentation fault
```
[Answer]
## Commodore 64 Basic, 15 bytes
```
?SYNTAX   ERROR
```
Produces
```
?SYNTAX  ERROR
```
(Note two spaces in the error message, where the program has three)
`?SYNTAX ERROR` is tied with `?VERIFY ERROR` as the third-shortest error message that C64 Basic can produce, and the shortest that can be reliably triggered by code (the shortest message, `BREAK IN 1`, requires user interaction, while `?LOAD ERROR` requires a defective tape or floppy disk, and `?VERIFY ERROR` requires the presence of a floppy or tape containing a file that doesn't match the program in RAM).
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~215~~ 189 bytes
```
[]
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X4lLPXH4AfX//wE "PowerShell ‚Äì Try It Online")
So, PowerShell has ... verbose ... error messages. Additionally, most non-syntax error messages are Runtime Exceptions, meaning that they're non-fatal, which reduces this problem to needing to find a short parsing error.
~~I *think* this is one of the shortest, if not *the* shortest,~~ @TessellatingHeckler has demonstrated this is the shortest parsing error, and it still weighs in at `188` bytes just for the error message. So we basically need to append enough `1`s to reach `189` bytes of "code."
Running this locally on `c:\a.ps1` for example, will cut down on the byte count by a handful as it's just a shorter file path, but then it's not available on TIO.
Produces error:
```
At /tmp/home/.code.tio.ps1:1 char:2
+ []
+  ~
Missing type name after '['.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingTypename
```
[Answer]
# Ruby (~~33~~ 32 bytes)
**32 bytes**
```
&
#abcdefghijklmnopqrstuvwxyz12
```
Throws the error (assuming in a file named "a"):
**31 bytes**
```
a:1: syntax error, unexpected &
```
**Edit**: Shaved a byte off by using `&` instead of `<<` thanks to [Eric](https://codegolf.stackexchange.com/users/65905/eric-duminil), who also came up with an even shorter Ruby solution:
<http://codegolf.stackexchange.com/a/135087/65905>
[Answer]
# [R](https://www.r-project.org/), ~~29~~ 28 bytes
*-1 byte thanks to JarkoDubbeldam*
```
a #abcdefghijklmnopqrstuvwxy
```
Throws the error `Error: object 'a' not found`which is 27 bytes.
[Try it online!](https://tio.run/##K/r/P1FBOTEpOSU1LT0jMys7Jzcvv6CwqLiktKy8ovL/fwA)
[Answer]
# Brainf\*\*k, 17 bytes, [this interpreter](http://fatiherikli.github.io/brainfuck-visualizer/#KysrKysrKysrKysrKysrPDw=)
```
+++++++++++++++<<
```
Brainf\*\*k is such a simple language that almost every interpreter has a different error message. This one uses `Memory Error: -1` for when the pointer is moved to the left too much and you attempt another operation
[Answer]
# [Common Lisp](http://www.clisp.org/), 20 bytes
```
(/ 1 0))))))))))))))
```
[Try it online!](https://tio.run/##S87JLC74/19DX8FQwUATBfz/DwA "Common Lisp ‚Äì Try It Online")
**Error Message**
```
/: division by zero
```
[Answer]
# TryAPL, 11 bytes
Code (11):
```
'abcdefghij
```
Error (10):
```
open quote
```
[Answer]
# ZX Spectrum Basic, 9 bytes
```
RUN USR 8
```
produces:
![Error message](https://i.stack.imgur.com/5wJQa.png)
Explanation:
I am (exceptionally) counting ASCII representation of the program for length purposes, including the end of line (it's not really important, since we could always pad a shorter program with spaces).
Usually, ZX Spectrum error messages are longer and more helpful than this - the ROM routine at 0x0008 expects error code following the machine code call to `RST 8`., and fetches some random (deterministic) byte from the ROM, which produces this nonsensical error message `M`. `5` is the error number, `,` is added by the error printing routine and `0:1` is the line:command position of the error.
[Answer]
# [ArnoldC](https://lhartikk.github.io/ArnoldC/), 150 bytes
```
IT'S SHOWTIME
HEY CHRISTMAS TREE b
YOU SET US UP 0
GET TO THE CHOPPER b
HERE IS MY INVITATION b
HE HAD TO SPLIT 0
ENOUGH TALK
YOU HAVE BEEN TERMINATED
```
[Try it online!](https://tio.run/##Hcw7DsJAEAPQPqdwR8sVFmJlRmQ/2pkNSsmnRCBxf2kJ6Szr2bfv@/N6PnpXPxhM8tU1chCuOEtV8xgMXknchzU3GB3N0AqOw7Rlz3DhZnMprBsSVkINcYWmRT245rT3kDD@vZVZfZsz5TYJPMyX/VrCQpzIBGeNmoJz7P0H "ArnoldC ‚Äì Try It Online")
Error is 94 bytes (including trailing newline):
```
Exception in thread "main" java.lang.ArithmeticException: / by zero
    at code.main(Hello.java)
```
---
Preserved because I think this is more funny - spoiler: it was those dang teenage pranksters.
# [ArnoldC](https://lhartikk.github.io/ArnoldC/), 280 bytes
```
IT'S SHOWTIME
HEY CHRISTMAS TREE BRBDoorBetterNotBeThosePeskyTeenagePranksters
YOU SET US UP 0
GET YOUR ASS TO MARS BRBDoorBetterNotBeThosePeskyTeenagePranksters
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY
YOU HAVE BEEN TERMINATED
```
Pseudocode:
```
start program
new variable
set to 0
set new variable to output from function
call function
take input
end program
```
[Try it online!](https://tio.run/##lY4xbsMwEAR7vWK7tPkCaZ5DIiEp844RVAoJYQM2REBSk9fLtBvX6RY7i8FOy1xvvz/77uSNwTYO4jx1lkYcbHIsXjEkEUEnbWpddNm2soS66SKXupa@rNc/KWWezqVfpvm6Nrx2Y8xgEmRG7vHefbTcugTFzRfhVeJ/Kk2EE4Q4dA6DCvLQKP58aKGgczhYxCNOmVhcDAwVDF5Tq74JYsm3ngdK1KD3ZJwS@hqfh58TTRQglLwLjZh9vwM "ArnoldC ‚Äì Try It Online")
Generates a "no input" error. (Almost all other errors in ArnoldC include a large piece of boilerplate):
279 bytes (including trailing newline):
```
Exception in thread "main" java.util.NoSuchElementException
    at java.util.Scanner.throwFor(Scanner.java:862)
    at java.util.Scanner.next(Scanner.java:1485)
    at java.util.Scanner.nextInt(Scanner.java:2117)
    at java.util.Scanner.nextInt(Scanner.java:2076)
    at code.main(Hello.java)
```
[Answer]
# [Perl 5](https://www.perl.org/), 5 bytes
```
die$/
```
Outputs a newline, for one byte.
[Try it online!](https://tio.run/##K0gtyjH9/z8lM1VF//9/AA "Perl 5 ‚Äì Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), 11 bytes
Since I'm not clear on whether my [other answer](https://codegolf.stackexchange.com/a/134957/18653) obeys the challenge rules, here's another alternative.
```
#line 0
die
```
Error output:
```
Died.
```
With an ending newline, for 6 bytes.
[Try it online!](https://tio.run/##K0gtyjH9/185JzMvVcGAKyUz9f9/AA "Perl 5 ‚Äì Try It Online")
For some reason the Perl interpreter internal function `Perl_mess_sv` contains:
```
if (CopLINE(cop))
    Perl_sv_catpvf(aTHX_ sv, " at %s line %" IVdf,
                    OutCopFILE(cop), (IV)CopLINE(cop));
```
where `CopLINE(cop)` gets the current code context's line number. So if that line number happens to evaluate to zero, Perl skips adding the usual `" at <filename> line <n>"` to the error message.
[Answer]
# GW-Basic, 9 bytes
Enter:
```
?&H100000
```
This will yield the following error message:
```
Overflow
```
I believe this is the shortest error message in GW-Basic. The reason I used a hexadecimal constant is that while GW-Basic doesn't support long integers, it does support single and double(!) precision floating point numbers.
[Answer]
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php) (on [TIO](https://tio.run/#)), 34 bytes
```
 
Nope, it's not valid Whitespace!
```
[Try it online.](https://tio.run/##K8/ILEktLkhMTv3/X4HLL78gVUchs0S9WCEvv0ShLDEnM0UhHK5E8f9/AA)
All characters that aren't a space, tab, or newline are ignore in Whitespace. So this program is actually `SNSSS` (where `S` is space, and `N` is newline). The first three (`SNS`) is the command to duplicate the value at the top of the stack. Since the stack is still empty, it gives the error:
```
wspace: user error (Can't do Dup)
```
I tried other errors, but this seems to be the shortest. Most errors where it tries to use a value on the stack which isn't present are similar, but longer. Here is a list of all possible errors (I could find) on TIO (for the first one it requires a character input, which it tries to read and print as number, so I've excluded that one - [Try it online.](https://tio.run/##TYo7CoAwEAXreIocwUPY2IRg0oksqy4Y0BDy0eOvBi3kVW9mrs1lSgEXYh6NrFMN6JI2aKexHiOhK2F3C2aqzArVWGEFDIQrGNv1CjCBL8dMsepP5ujopLc38kE6Op9/KTPe)):
```
wspace: Prelude.read: no parse
wspace: user error (Can't do Dup)
wspace: user error (Can't do Swap)
wspace: Prelude.!!: index too large
wspace: user error (Can't do Store)
wspace: user error (Can't do Return)
wspace: user error (Can't do Discard)
wspace: user error (Can't do Slide 0)
wspace: user error (Can't do ReadNum)
wspace: user error (Can't do Retrieve)
wspace: user error (Can't do ReadChar)
wspace: <stdin>: hGetChar: end of file
wspace: <stdin>: hGetLine: end of file
wspace: user error (Can't do OutputNum)
wspace: Prelude.chr: bad argument: (-1)
wspace: user error (Can't do Infix Plus)
wspace: user error (Can't do OutputChar)
wspace: user error (Undefined label ( ))
wspace: user error (Can't do Infix Minus)
wspace: user error (Can't do Infix Times)
wspace: user error (Can't do If Zero " ")
wspace: user error (Can't do Infix Divide)
wspace: user error (Can't do Infix Modulo)
wspace: user error (Can't do If Negative " ")
wspace: Input.hs:(108,5)-(109,51): Non-exhaustive patterns in function parseNum'
wspace: Unrecognised input\nCallStack (from HasCallStack):\n  error, called at Input.hs:103:11 in main:Input
wspace: Stack space overflow: current size 33624 bytes.\nwspace: Relink with -rtsopts and use `+RTS -Ksize -RTS' to increase it.
```
---
NOTE: Whitespace compilers have their own implementations for error messages. All these errors above are on TIO. If I use the online Whitespace compiler [vii5ard](http://vii5ard.github.io/whitespace/) instead, and use the same program at the top, it will give this error instead:
```
ERROR: Runtime Error: Stack underflow
```
So using the vii5ard online Whitespace compiler I could lower my byte-score to:
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php) (on [vii5ard](http://vii5ard.github.io/whitespace/)), 15 bytes
```
Unexpected EOF!
```
Which is the 'program' `S` (a single space), resulting in the error:
```
Unexpected EOF
```
(Which would result in [`wspace: Unrecognised input\nCallStack (from HasCallStack):\n error, called at Input.hs:103:11 in main:Input` on TIO](https://tio.run/##K8/ILEktLkhMTv3/PzQvtaIgNbkkNUXB1d9N8f9/AA)).
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~410~~ 411 bytes
```
One plus one is two, two plus two is four.
And now, some random character spam just because I can.
3...
2...
1...
GO!
ooi1u4`o1i2)I#1n[09i43u`1@#~!@#{10239`]Œπ@(~!)2ioausioe7u12o3iu71p3123`71i2`8127l5ruy;3948'p3298rv9pe8huep'r8i19o`8u'3pie8uiouI!^23uT7T17I3YJH~:L'I`YU2O123;121@
That should be about it, it errored. Guess that's what happens when you spam. Bye for now!
upvote if you liked my creativity
:)
```
[Try it online!](https://tio.run/##JZDBSsNAEIbveYopPcRCCe5uJYleqheNCL3Ug4iSbTKS1Taz7O60BKHv5Uv4SnVTD/MzM/zzw3zk9cbg6bTqEeyWPVBsjIdwoPko/8uxicsPYpclt30LPR3m4GmH4HTf0g6aTjvdBHTgrd7BJ/sAG2w0e4QKGt1nicqyLJGjiFHuV5MkITKCFzUJI2fVVPSvl6VZKK7FcnqcLKff4lKqsn77/VleHCczaSgGGsKchSRlOBdWCanqPN7XhZD59srxcKPKRZFaJcvC7UuLRcdoU1cYUVJdcKqswYINcTV5l4rX@VrklXp5fDheP6VV/fIsVzH0RkixTJJ1pwP4jnjbxodAb4gDmDCPBegcOWwzuGf0kVK0ph4O40WnrcV@HLCHgfiMJYO7ASNFN/KL3yds9xQi74@zZWu@sIXdAI1DHczehCF6rmen0x8 "05AB1E ‚Äì Try It Online")
```
One plus one i...]Œπ...  # trimmed program
One plus one            # push empty string ("") twice
             i          # if top of stack is truthy...
              ...       # execute (trimmed) code (this is unreachable)
                 ]      # exit all opened statements
                  Œπ     # not exactly sure what this function does, but part of it forcefully converts top of stack to an integer (without error handling), therefore erroring
                   ...  # unreachable code as program has quit from the fatal error
```
# Error, 410 bytes
```
** (RuntimeError) Could not convert  to integer.
    (osabie) lib/interp/functions.ex:101: Interp.Functions.to_integer!/1
    (osabie) lib/interp/commands/special_interp.ex:113: Interp.SpecialInterp.interp_step/3
    (osabie) lib/interp/interpreter.ex:127: Interp.Interpretr.interp/3
    (osabie) lib/osabie.ex:62: Osabie.CLI.main/1
    (elixir) lib/kernel/cli.ex:105: anonymous fn/3 in Kernel.CLI.exec_fun/2
```
[Answer]
# Javascript (Firefox), ~~29~~ 27 bytes
```
new Date('-').toISOString()
```
throws `RangeError: invalid date` which is 24 bytes.
Tested on Firefox 54.0.1 on Windows 10.
]