| Bytes | Lang | Time | Link |
|---|---|---|---|
| 003 | Vyxal | 240906T111523Z | emanresu |
| 039 | Swift 5.9.2 | 240301T170030Z | macOSist |
| 017 | Bespoke | 250125T050353Z | Josiah W |
| 012 | Emojigramming | 240512T012649Z | None1 |
| 065 | Pip | 240509T063026Z | DLosc |
| 019 | C Linux | 240509T055922Z | ntfs.har |
| 014 | Bash | 240508T200401Z | cnamejj |
| 067 | Go | 240227T154756Z | bigyihsu |
| 038 | YASEPL | 240227T154130Z | madeforl |
| 020 | /bin/sh "dash" on Ubuntu Bionic | 201224T045533Z | cnamejj |
| 038 | Vyxal 3 | 240227T143753Z | pacman25 |
| 012 | Setanta | 230720T081219Z | bb94 |
| 038 | Raku Perl 6 rakudo | 230720T080621Z | bb94 |
| 029 | Python 3 | 230719T143839Z | The Empt |
| 027 | Javascript Firefox | 170722T141354Z | SuperSto |
| 019 | Whitespace wspace 0.3 | 220103T061050Z | thaliaar |
| 035 | Python | 220102T192839Z | Caelus |
| 071 | CPython 3.9 | 220101T085947Z | pxeger |
| 017 | Vim | 211223T151700Z | Aaroneou |
| 057 | Rust | 201117T202501Z | Aiden4 |
| 047 | COBOLGNU | 210607T190939Z | smarnav |
| 309 | Vyxal | 210105T081604Z | lyxal |
| 038 | naz | 210101T064001Z | sporebal |
| 016 | C | 201224T153259Z | EasyasPi |
| 411 | 05AB1E | 201117T004255Z | Makonede |
| 100 | Shakespeare Programming Language | 201216T221602Z | Hello Go |
| 029 | Red | 201117T212300Z | Fighting |
| 026 | GNU Smalltalk | 190910T190403Z | user1525 |
| 030 | Python | 190910T182010Z | Sagittar |
| 059 | C# .NET | 190820T173344Z | canttalk |
| 029 | @ | 190810T182029Z | user8505 |
| 050 | Loader | 181019T121550Z | SuperJed |
| 048 | Coconut | 181018T155020Z | Citty |
| 009 | IE9 Chinese version | 181017T185219Z | l4m2 |
| 002 | Sinclair ZX81 | 171113T132513Z | Shaun Be |
| 003 | ed | 180704T111336Z | null |
| 048 | Shakespeare Programming Language | 180627T002551Z | Jo King |
| 034 | Whitespace on TIO | 180627T125714Z | Kevin Cr |
| 011 | SmileBASIC console | 171024T163240Z | 12Me21 |
| 029 | F# | 180626T203342Z | Ciaran_M |
| 073 | Shakespeare Programming Language | 170726T171658Z | Maya |
| 036 | Go | 180626T214528Z | lukass |
| 009 | TIBasic | 170722T011533Z | Timtech |
| 040 | Attache | 180626T192332Z | Conor O& |
| 020 | Julia 0.6 REPL/e | 180626T185235Z | Sundar R |
| 022 | Japt | 170721T204207Z | Shaggy |
| 041 | Aceto | 171225T171414Z | qqq |
| 013 | JavaScript | 171024T160042Z | user7520 |
| 028 | Octave | 171109T130505Z | Stewie G |
| 056 | PHP | 170722T164330Z | rexkogit |
| 017 | Eukleides | 171024T180721Z | brhfl |
| 018 | Batch | 170723T015031Z | user6318 |
| 026 | ><> | 170727T234229Z | jellies |
| 025 | C# .Net | 170727T155207Z | TehPers |
| 019 | Vim | 170727T152743Z | jacwah |
| 185 | dc GNU 1.2 on Windows 10 x64 | 170726T175356Z | juh |
| 150 | ArnoldC | 170724T175920Z | Temporal |
| 043 | MATLAB | 170726T113720Z | Tom Carp |
| nan | JAVA 8 | 170726T095635Z | XtremeBa |
| 047 | PHP | 170726T024130Z | manasseh |
| 069 | Groovy | 170725T191106Z | Fels |
| 028 | R | 170721T192629Z | Giuseppe |
| 021 | JavaScript Firefox | 170721T204754Z | Oliver |
| 2625 | Prolog SWI | 170725T125318Z | Fatalize |
| 009 | BASIC BBC micro | 170725T123038Z | Baldrick |
| 009 | R | 170725T104801Z | jochen |
| 030 | TrumpScript | 170725T012430Z | Timtech |
| 029 | VBA | 170722T172309Z | Taylor R |
| 043 | Java 7 | 170724T171834Z | Poke |
| nan | C++ MinGW + GCC + Windows | 170724T165008Z | Keyu Gan |
| 026 | C++ | 170724T161031Z | Robert A |
| 024 | Javascript V8 | 170724T125128Z | Max Sine |
| 189 | PowerShell | 170721T193350Z | AdmBorkB |
| 054 | Braingolf | 170724T083824Z | Mayube |
| 046 | C# | 170724T080707Z | TheLetha |
| 007 | LibreOffice Calc | 170724T055644Z | tsh |
| 025 | Rexx Regina | 170724T054038Z | theblitz |
| 023 | C++ on macOS High Sierra beta | 170724T034249Z | fluffy |
| 079 | Python 2 | 170721T190202Z | totallyh |
| 032 | Ruby | 170721T195255Z | ameketa |
| 009 | GWBasic | 170723T185745Z | Anonymou |
| 010 | TRS80 Model 100 Basic | 170723T182248Z | Anonymou |
| 029 | Bash | 170723T145931Z | JoshRage |
| 009 | ZX Spectrum Basic | 170723T080117Z | Radovan |
| 025 | Ruby | 170722T195538Z | Eric Dum |
| 079 | Javascript | 170723T020451Z | user6318 |
| 021 | ExtraC | 170723T015726Z | user6318 |
| 014 | Applesoft BASIC | 170723T005308Z | MD XF |
| 013 | GWBASIC | 170723T005001Z | MD XF |
| 015 | Commodore 64 Basic | 170723T002310Z | Mark |
| 036 | Mathematica kernel | 170722T032253Z | JungHwan |
| 014 | 4 | 170722T212903Z | Uriel |
| 025 | System V shell | 170721T204424Z | MD XF |
| 011 | Perl 5 | 170722T173228Z | ascheple |
| 003 | ed | 170721T200612Z | Anders K |
| 010 | Casio Basic | 170722T140631Z | numberma |
| 023 | Batch | 170722T002210Z | Neil |
| 120 | Mathematica | 170721T192028Z | ZaMoC |
| 019 | C Modern Linux | 170721T195005Z | totallyh |
| 067 | Python 3 | 170721T191528Z | 0xffcour |
| 050 | 2Col | 170722T093802Z | Mayube |
| 067 | Python 2 | 170721T194704Z | Koishore |
| 013 | C/*nix | 170722T033820Z | MD XF |
| 077 | Ly | 170722T030340Z | LyricLy |
| 005 | Perl 5 | 170722T011502Z | ascheple |
| 015 | Tcl | 170722T005057Z | sergiol |
| 019 | Tcl/Tk | 170721T231441Z | sergiol |
| 011 | TryAPL | 170721T194332Z | Adalynn |
| 032 | Japt | 170721T202656Z | Oliver |
| 053 | Aubergine | 170721T202216Z | user5882 |
| 019 | C modern Linux | 170721T202148Z | MD XF |
| 021 | Taxi | 170721T191934Z | Stephen |
| 021 | Haystack | 170721T201207Z | user5882 |
| 024 | Zsh | 170721T195931Z | user5882 |
| 013 | Haskell | 170721T195720Z | Anders K |
| 133 | C++ | 170721T192157Z | Ivan Bot |
| nan | BrainFlak BrainHack | 170721T195444Z | Wheat Wi |
| 045 | Lua | 170721T195312Z | 0xffcour |
| 020 | Bash | 170721T195211Z | user5882 |
| 011 | QBasic | 170721T194452Z | steenber |
| 035 | Python 2 | 170721T194422Z | orlp |
| 010 | J | 170721T193852Z | Richard |
| 020 | Common Lisp | 170721T192910Z | Cheldon |
| 031 | JavaScript Firefox | 170721T192158Z | ETHprodu |
| 046 | BrainFlak | 170721T191742Z | DJMcMayh |
| 071 | Python 3 | 170721T191631Z | hyperneu |
| 017 | Brainf**k | 170721T191203Z | hyperneu |
| 020 | Add++ | 170721T191103Z | caird co |
| 026 | ><> | 170721T190730Z | hyperneu |
Vyxal, 3 bytes
1ƛ°
Try it Online! -1 byte thanks to pacman256.
Outputs ⟨ .
Vyxal's online mode has a weird quirk where, if an error occurs inside a lazily-evaluated list, the error message won't actually get printed. We're not entirely sure why this happens, but this means the entirety of stdout is Vyxal starting to print a list ⟨ , which I think can reasonably be considered an error message - especially since, outside of explicitly printing that string, it'd never occur in normal use.
Aside from that, it's actually kinda difficult to throw a runtime error in Vyxal. Basically every single-byte builtin has either type coercion or useful behaviour for all types, so a previous version of this used the two-byte run-length decoding builtin ød which expects a list.
However, this version uses °, Vyxal's almost-never-used complex number format. x°y translates to x + iy, and the cases x° and °y become x + i and iy respectively. But ° alone throws a syntax error.
Except, it doesn't throw an error at parse time, nor does it throw a syntax error when the transpiled Python is evaluated. Rather, it's compiled to sympy.nsimplify("+*I"), where there's nothing due to the lack of either real parts or imaginary parts - and that throws an error.
Swift 5.9.2, 46 41 39 bytes
let heresARemarkablyLengthyIdentifier
:
Error, 45 40 38 bytes (when compiled from standard input)
<stdin>:2:2: error: expected type
:
^
Bespoke, 17 bytes
go out with error
This program is equivalent to the "mnemonic" code DO ROT; PUSH FIFTH. When DO ROT is run on the empty stack, it errors out with the 16-byte error message Stack underflow..
Emoji-gramming, 12 bytes
😊🎤📢
Error, 69 bytes
💻 ⚠️ ➡️ 🚨 1
⚠ 🎤 ↔️ 📢
😊 🎤 📢
None
I don't know if the None and the trailing line feed in the output count or not.
The error means that the 🎤 (input variable) and the 📢 (output variable) are in the wrong place.
Pip, 65 bytes
Fatal error while parsing: Unterminated list
Execution aborted.
[
Outputs the following 64-byte error message:
Fatal error while parsing: Unterminated list
Execution aborted.
The problem is the [ without a matching ], which causes a syntax error. Everything else is valid Pip code; if the missing ] were added, the program would run successfully and output nothing (empty list joined into a string) followed by a newline.
C (Linux), 19 bytes (but code much simpler)
main ;
Output:
Segmentation fault
Bash, 14 bytes
2>&1 ~|cut -b1
This may or may not fit the rules, I'm not sure... If manipulating the error message is not allowed, I'll remove it. But I thought it was amusing enough to post.
It works by running ~ as a command to generate an error. But since 2>&1 redirects STDOUT to STDIN, the error is passed to cut -b1 which truncates the output to 1 byte.
Go, 67 bytes
package main
func main(){var f string = "aaaaaaaaaaaaaaaaaaaaaaaa"}
Gives the following error (66 bytes):
# command-line-arguments
../code.go:2:17: f declared and not used
YASEPL, 38 bytes
=p/0+000000000000000000000000000000000
error message:
ERROR 8 divide by 0:(
located at /0
/bin/sh ("dash" on Ubuntu Bionic), 20 bytes
cd /;ok="okokokok";@
Output is:
sh: 1: @: not found
The cd / command it just to make sure to switch to a location where there isn't a file named @ since that's effectively what causes the error.
Raku (Perl 6) (rakudo), 38 bytes
die#iaj zav; xbsio la, n v km l s zioa
When run using raku -e, this produces the 37-byte output
Died
in block <unit> at -e line 1
Python 3, 29 Bytes
from __future__ import braces
Error
SyntaxError: not a chance
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.
Whitespace (wspace 0.3), 19 bytes
SSSSL
SLS
TSTS
TLST
LLL
Error: w: divide by zero (18 bytes)
The zero divisor error is the shortest error message produced by the wspace 0.3 reference interpreter (see the yspace project for a survey of other errors). Using mod in place of div would yield an equivalent result. The reference interpreter was written in Haskell, so arithmetic operations are evaluated lazily and it will not panic with divide by zero unless the illegal value is used by an eager instruction—printi in this case. To reach the minimum byte count, push 0 is written as SSSSL and end is appended.
push 0
dup
div
printi
end
Renaming wspace to w gives a shorter error message.
$ ln -s ~/bin/wspace w
$ ./w codegolf/shortest_error.ws
w: divide by zero
$ ./w shortest_error.ws 2>| wc -c
18
$ wc -c < shortest_error.ws
19
(This solution is part of the ws-challenges repo)
Python, 35 bytes
Pretty simple.
print(a)###########################
Prints out an undeclared variable then adds a comment to make sure that the error message (NameError: name 'a' is not defined) is shorter than the actual code. I could've probably done better.
CPython 3.9, 71 bytes
__peg_parser__
########################################################
Not the shortest, but I found this "feature" worth sharing nonetheless: when Python 3.9 switched to a PEG parser, there was a special easter egg keyword __peg_parser__ added which immediately causes a syntax error. The error outputted is:
File "a", line 1
__peg_parser__
^
SyntaxError: You found it!
This was removed in Python 3.10.
Vim, 17 bytes
:w {
When you write to a file and you have an unmatched starting curly brace in the filename, it will give the error E220: Missing }. The code to get this error is very short, so we just pad it out with spaces to get to the length we want. You can't see this error on TIO, but it works in the terminal.
Rust, 61 57 bytes
fn main()->Result<(),usize>{[].binary_search(&0)?;Ok(())}
Returns from the main function with Error: 0.
-3 bytes thanks to Anders Kaesorg
COBOL(GNU), 47 bytes
PROCEDURE DIVISION. HELLO. HELLO. HELLO. HELLO.
Outputs:
main.cobc: 1: error: PROGRAM-ID header missing
Assuming filename = main.cobc
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 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)
naz, 38 bytes
1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a4x
Explanation
1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a # Add 1 to the register 18 times
4x # Set the current opcode to 4
The only opcodes accepted by the naz interpreter under any circumstances are 0 (normal operation), 1 (function write), 2 (variable write), and 3 (conditional). Thus, if run from a file with a one-letter filename (e.g. f.naz), this program will produce the following 37-byte error:
error: invalid opcode
at f.naz:1:38
C, Bionic libc (Android, Termux), 16 characters
main(){free(1);}
Output, 8 characters (including newline)
Aborted
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
:)
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
Shakespeare Programming Language, 100 bytes
,.Ajax,.Puck,.Act I:.Scene I:.[Enter Ajax and Puck]Ajax:You cat!You is the quotient betweenyou zero.
which produces
Runtime error at line 1: Unable to divide 1 by zero!
The error is 53 bytes including the trailing newline.
I really don't see how this can be improved (unless I missed something obvious). It loads 1 into Puck and attempts to divide him by 0.
Red, 29 Bytes
a/1/1/1/1/1/1/1/1/1/1/1/1/1/1
Script Error: a has no value
GNU Smalltalk, 26 bytes
Create a source file _ with underscores:
__________________________
Running gst _, the error is 25 bytes including :
_:1: expected expression
Underscore was originally mapped to ←, the assignment operator prior to :=.
Python, 30 bytes
import math as ma; ma.sqrt(-1)
Error: ValueError: math domain error (29 bytes)
C# .NET, 59 bytes
public class P{static void Main(){int je=0;int iee=je/je;}}
Try Online
Produces the following error (58 bytes):
System.DivideByZeroException: Attempted to divide by zero.
(NOTE: I am not counting in the stacktrace that the .NET Compiler generates)
@, 29 bytes
Error: Unknown instruction E!
This tries to call the function E, which does not exist.
Output message:
Error: Unknown instruction E
Loader, 50 bytes
load t
This is line not executed because of error.
Assumptions:
- The program is run from a file with a one-byte name
- The module named
tdoes not exist.
The error message (assuming you run from a module named m) is:
Error: module t does not exist (module m, line 1)
Coconut, 48 bytes
Code:
+
CoconutParsererErrorr: parsing failed (line 1)
Prints error (47 bytes):
CoconutParseError: parsing failed (line 1)
+
with a trailing newline
IE9 Chinese version, 9 bytes
'12345'()
Outputs (assuming GBK encoding)
缺少函数
Sinclair ZX81 - 8 bytes 4 bytes 2 bytes (2 BASIC tokens) using direct mode:
Newest solution
PRINT A
Less old solution
PRINT A+A
Old solution (8 bytes of memory):
1 PRINT A
When you enter the command RUN, the following error is reported:
2/1
as in the screen shot below - Error code 2 means "Undefined variable" or something similar.
ed, 3 bytes
?
Returns the following error message (2 bytes).
?
ed is Turing complete, so there shouldn't be issues about whether using it is valid or not. There was a solution in ed before, but it was removed, as there was a concern whether this is a fatal error. I would say, yes, it is, no matter what I did on TIO.run, the execution did not continue after getting an error message. From checking why this happens, it appears that the execution continues only when the code is read from STDIN (REPL mode).
Inspired by https://www.gnu.org/fun/jokes/ed-msg.html
Note that the output contains 0, but it's not a part of an error message, rather it's ed displaying file size by default. It can be removed by using -s flag. If you try changing the input provided to the program, it will change.
Shakespeare Programming Language, 48 bytes
,a.Ajax,a.Act I:a.Scene I:a.[Enter Ajax]I error!
Produces:
Unrecognized error encountered. No code output.
There's not much we can do about creating runtime errors, because the minimum overhead to create a program with two characters is 56 bytes, and you can't do much with one character. Instead, we settle for confusing the compiler, which means finding a sentence structure which doesn't fit the grammar rules. In this case, anything that isn't a character name after a character enters the stage.
Shorter error messages exist, for example Error at line 1: act expected, but the code compiled isn't valid, so you get an extra few lines of gibberish after the first error message.
Whitespace (on TIO), 34 bytes
Nope, it's not valid Whitespace!
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.):
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 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 (on vii5ard), 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).
SmileBASIC console, 12 11 bytes
?@L*EXP(22)
Error message (8 or 9 bytes):
Overflow
Must be run from the console, otherwise it outputs a line number. Normally errors are formatted like {error} in {slot}:{line}({func}:{arg}), but this error isn't caused by a function and doesn't have a line number so only the error name is shown.
EXP(x) returns e^x, and e^22 is 3584912846.131588. This is outside the 32 bit signed integer range of -2147483648 to 2147483647. Multiplying a string (@L) by this value converts it to an integer, causing an overflow error.
F#, 29 bytes code, 28 bytes error message
let [<EntryPoint>] main a=1/0
Generates the runtime Exception message:
Attempted to divide by zero.
+5 bytes thanks to lukass.
Shakespeare Programming Language, 73 bytes
Errors.
Ajax, the web technology.
Act XLII:;.
Scene LXIX:;.
Ajax:You cat.
Error message, 72 bytes
Runtime error at line 7: Ajax is not on stage, and thus cannot speak!
with one leading and two trailing newlines. Not sure whether the newlines count.
Go, 36 bytes
package verylongnamednonmainpackage;
Produces:
go run: cannot run non-main package
TI-Basic, 9 bytes
Shortest error messages are 8 bytes each: ERR:DATE, ERR:MODE, ERR:STAT, and ERR:ZOOM. I didn't consider ERR:DATE because that doesn't work on models without an internal clock. Also, I didn't go for ERR:ZOOM because it seemed too hard to trigger.
Program (9 bytes):
Seq:DrawInv X:::::
Error message: ERR:MODE (8 bytes)
Program (9 bytes):
median({1},{0::
Error message: ERR:STAT (8 bytes)
Attache, 40 bytes
A Reference Error: Undefined variable!!!
Message (39 bytes): Reference Error: Undefined variable "A"
Julia 0.6 (REPL/-e), 20 bytes
print(factorial(-9))
produces:
ERROR: DomainError:
(assuming stacktraces don't count) which is 19 bytes.
Older answer, 22 bytes:
println(Int(Inf)+0123)
Produces
ERROR: InexactError()
which is 21 bytes.
Trivial answer, 7 bytes (probably falls short of "The error message may not be generated by the program itself, such as Python's raise" requirement):
error()
produces
ERROR:
Japt, 22 bytes
Dusting off the golfing cobwebs after a week's holidays; there's probably a shorter solution.
888888888888888888888z
Error:
No such function: N.z
Aceto, 41 bytes
&
Produces __main__.CodeException: Raised an &rror.
The error message is 40 chars, so...
JavaScript, 13 bytes
prompt(alert(
Error produced (12 bytes):
Expected ')'
Octave, 28 bytes
a=[];'Will cause error';a(1)
This throws this error:
error: a(1): out of bound 0
Damn, golfing error messages was cumbersome! I have rewritten this answer 8 times now, since I've gradually found error messages that were one byte shorter than the previous one. I think this answer took me an hour, since I've made a complete rewrite 8 times... :(
Why is this the shortest error message?
Relying on undefined functions or variables is not short enough (41)
error: 'a' undefined near line 1 column 1Relying on the wrong input type is not short enough (38)
error: mod: wrong type argument 'sq_string' error: whos: all arguments must be strings error: sum: wrong type argument 'cell'Relying on syntax errors is definitely not short enough (42)
parse error: syntax error >>> & ^Wrong indexing is not short enough (38)
error: scalar cannot be indexed with {Short function names and inputs that cause errors is not short enough (34)
error: a: No such file or directory error: load: unable to find file a
I've looked through all the functions in Octave, and I can't imagine anything being shorter than this.
PHP, 56 bytes
<?php aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
produces
PHP Parse error: syntax error, unexpected end of file
Eukleides, 17 bytes
Program:
a=centroid(empty)
Error:
X:1: empty set.
(Plus a newline). All fatal errors in Eukleides begin with (filename):(line number): and end with a period and a newline. I combed the source, and found that empty set was the shortest error. At first, I thought I was out of luck, because I only saw the lengthy command isobarycenter throwing it, but spotted centroid throwing it as well. Then I couldn't figure out how to make an empty set; all my attempts got me a syntax error first. Turns out, empty is a constant for an empty set, something I never needed to know before. I am quite confident this is the shortest Eukleides solution.
Batch 90 18 bytes
@set/ab=1+*2*3*4*5
Missing Operand\
Golfed by SteveFest
><>, 26 Bytes
Code: "we'refinehereuntilthis!"z
Error: Something smells fishy...
All ><> errors are Something smells fishy...
C# (.Net, Mono) 25 bytes
class Hi{void There(){_}}
Error:
error CS1002: ; expected
Note: Mono error messages include filename and location before them, so if you named the file P.cs, you'd get this error:
P.cs(1,24): error CS1002: ; expected
Since that part depends on the filename and location of text, I didn't include it. However, if you include it (and make the class name longer or something), you end up with a 36 byte error message and 37 byte program. Let me know if I should change it to that.
Vim, 19 bytes?
:print "ex command
With a trailing newline, this prints the current line to the messages window. If the buffer is empty, it shows E749: empty buffer instead. The " starts a comment.
I'm an very unsure how to count the number of bytes both in the input and error message. The command can be run as vim +"print \"ex command" (17 bytes?), but this adds an additional line to the error message: Error detected while processing command line: (total 62 bytes?).
Alternatively, the command can be put in a file and run the the following hack to trick Vim it is user input: cat cmd.vim - | vim --not-a-term. Without --not-a-term Vim writes Vim: Warning: Input is not from a terminal.
I didn't count the error message length including a newline since Vim won't write a newline to the screen; it uses ncurses or similar to directly draw at specific coordinates.
There is one potentially shorter error message: E572: Exit code %d. It can be triggered by :tcl, but I'll leave it to someone who has +tcl enabled.
dc (GNU 1.2) on Windows 10 x64, 185 bytes
dc doesn't crash fatally very often, and I couldn't be bothered to remember code that causes a segfault. I did recall some weird behavior involving arrays that causes a sad and total loss of the current session.
zzz zzzzzzz zz zzzzz zzzzz zzzzzzzzzz zzzz zzzzzzzzzzz zzz zzzzzzzzz zzz zzzzzzz zz zzzzzzzzz zz zz zz zzzzzzz zzzz zzzzzz zzzzzzz zzz zzzzzzzzzzzzz zzzzzzz zzzz zzz zzzz zzzzzzzz:zlz
Pushes numbers on the stack until the last five characters. :z stores the second-to-topmost number in the topmost-indexed slot in the array named z. Typically, this array would be linked through time and space to the current instance in the register named z. However, we haven't actually put anything there. Next, we try to lz, or copy the value on top of z to the top of the main stack. We can't: there's nothing there. I'm not sure why this mechanism triggers the failure that it does, but it works. (Or...doesn't.) The trailing newline is significant for two reasons: it puts the code in the black at 185, and pasting it into dc causes it to crash immediately.
Basically, we're running across a canyon, and as long as we don't look down, we're good. But once we look and realize we're floating in mid-air, we fall and crash hard, and little stars zoom around our poor befuddled heads.
Error, 184 bytes
dc: garbage in value being duplicated This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
I'm not sure if only part of that is the actual error or what, so feel free to correct me. The code is obviously very flexible when it comes to length.
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
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, 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
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)
MATLAB, 52 44 43 bytes
Another shorter option is to use a function and not provide enough inputs. For example:
qr()%I'm a nice comment to make code longer
Gives this 42 byte error:
Error using qr
Not enough input arguments.
This code (or to be fair any similar code:
[1 1]*[2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ]
Produces the following 51 byte error:
Error using *
Inner matrix dimensions must agree.
It's actually surprisingly tricky in MATLAB because when you run any code with syntax errors the error output includes the line of code you ran - which would put a theoretical lower limit on code size of infinity. Fortunately matrix multiplication errors don't do that.
JAVA 8, 137 bytes error and 138 bytes code
package a;
public class a{
public static void main(String[] args){
String f = "sdfgsfdgdffffffffffffffffffffffffsfdgfd";
a = 5;
}
}
produces the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
a cannot be resolved to a variable
at a.a.main(a.java:6)
as this is my first time please tell me if i did something wrong
PHP, 47 Bytes
<?php echo 'program including divide by 0',1/0;
produces:
PHP Warning: Division by zero in - on line 1 plus a newline.
Groovy, 69 bytes
java.lang.Class.metaClass=Integer.metaClass
Integer.metaClass.plus={1}
Error message is:
java.lang.StackOverflowError
I don't know if this will count at 31 bytes, because it will output a lot of line numbers:
aaaaaaa={aaaaaaa()};aaaaaaa()
Output:
java.lang.StackOverflowError
at Script1$_run_closure1.doCall(Script1.groovy:1)
at Script1$_run_closure1.doCall(Script1.groovy)
at Script1$_run_closure1.doCall(Script1.groovy:1)
at Script1$_run_closure1.doCall(Script1.groovy)
...
R, 29 28 bytes
-1 byte thanks to JarkoDubbeldam
a #abcdefghijklmnopqrstuvwxy
Throws the error Error: object 'a' not foundwhich is 27 bytes.
JavaScript (Firefox), 21 bytes
(a=null)=>a.charAt(1)
Error (20 bytes): TypeError: a is null
Prolog (SWI), 26 bytes (error: 25 bytes)
a :- a ; a ; a ; a ; a ;a.
This will generate the error: ERROR: Out of local stack (which is, as far as I know, the shortest error message that can be generated by SWI-Prolog).
Explanation
The above program can be simplified to a :- a ; a. (the other ; as are here so that the program is longer than the error message).
The above program says:
a :- . % For a to be true…
a % Either a…
; % …or…
a % …a must be true
This is obviously infinitely recursive, hence why we get an Out of local stack error.
However, the following program:
a :- a.
is also infinitely recursive but will never crash. This is because in that case, tail recursion optimization occurs so that the recursive call does not consume memory.
a :- a ; a. is also tail recursive; however we have introduced a disjunction with ; which prevents the recursive call from not consuming memory, because Prolog has to remember that there was another choice possible to explore instead of each recursive call.
It is possible to generate this same error with other approaches (e.g. using length(_,1000000000) to generate a list too big to fit in memory), but this one is probably the coolest looking one.
BASIC (BBC micro) 9 bytes
>REN 9,-5
Silly.
R, 9 bytes
[edited, because I can't count to 8]
code (9 bytes):
stop();;;
output (8 bytes, including trailing space and newline):
Error:
According to the manual, "stop stops execution of the current expression and executes an error action." The first argument is meant to be an error message, but can be omitted.
VBA, 29 Bytes
Anonymous VBE immediate window function of length 29 which throws Runtime error 6, (len 28) to STDERR
Code
?CByte(Len(Space(127+128+1)))
Error
Run-time error '6':
Overflow
Java 7, 43 bytes
Based on a comment from the OP, we are allowed to assume the filename is 1 character long. This program has that assumption and my example uses the source code's filename z.java
// public static void main(String[] args){}
Error message:
Error: Could not find or load main class z
C++ (MinGW + GCC + Windows), compile time, 38 39 46 bytes
According to OP's comment, it seems OK to assume the file is stored in a designated path. The code needs to be saved in a 8-byte location such as D:\a.cpp.
#if 1/*aaaaaaaaaaaaaaaaaaaaaaaaaaaaa*/
Error message:
D:\a.cpp:1:0: error: unterminated #if
The principle should work on other platforms.
C++, 26 bytes
int main(){div(1,0);} //??
Result in Windows:
a.exe has stopped working
Javascript (V8), 24 bytes
decodeURIComponent('%');
Error, 23 bytes:
URIError: URI malformed
Tested on Nodejs v6.11.0 and Google Chrome v59.0.3071.115.
Note that TIO expands the error message.
PowerShell, 215 189 bytes
[]
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
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 1s 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
Braingolf, 54 bytes
"ZeroDivisionError: integer division or modulo by z"0/
Throws the 53 byte error ZeroDivisionError: integer division or modulo by zero
Explanation
"ZeroDivisionError: integer division or modulo by z" is a string literal, pushes the error minus 3 bytes.
0 pushes 0, and / attempts to divide the 2nd to last item by the last item, in this case dividing z (122) by 0, which results in a divide by zero error.
Braingolf, 84 bytes
"ValueError: Indices for islice() must be None or an integer: 0 <= x <= sys.maxs"&@@
I personally get this error quite often when screwing around with ASCII art challenges in Braingolf.
Throws a ValueError: Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize. error.
Explanation
"ValueError: Indices for islice() must be None or an integer: 0 <= x <= sys.max" is a string literal. It's just the error minus 4 bytes, because the code must be longer than the error.
&@ then pops and prints the entire stack.
Finally @ attempts to pop and print an item from the now empty stack. Popping from an empty stack produces the above 83 byte error.
C#, 46 bytes
class P{public static int Main(string[]arg){}}
And produces the error at 45 bytes:
'P.Main()': not all code paths return a value
Probably a shorter way to do this in C# but I can't think of it.
LibreOffice Calc, 7 bytes
=aaaaaa
Result:
#NAME?
Rexx (Regina), 25 bytes
interpret interpret 2+3+1
"interpret" treats the text following it as source and tries to execute it. Since 2+3+1 is not included in quotes it treats it as a calculation and does that first. Resulting in "interpret interpret 6" The first "interpret" tells REXX to treat "interpret 6" as source. So it executes it. This results in the attempt to execute 6 as source.
sh: 6: command not found
C++ (on macOS High Sierra beta), 23 characters
int main(){*(int*)0=0;}
Output: (22 characters)
Segmentation fault: 11
I do not recall whether previous versions of macOS provide the more traditional Segmentation fault (core dumped) response but adding spaces to the code to pad that out is pretty trivial.
Python 2, 87 79 bytes
-8 bytes thanks to Zacharý and Erik the Outgolfer.
from __future__ import braces
#i am most surely seriously actually totallyhuman
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
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, who also came up with an even shorter Ruby solution:
http://codegolf.stackexchange.com/a/135087/65905
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.
TRS-80 Model 100 Basic, 10 bytes
Enter this:
??????????
Resulting error message:
?SN Error
All Basic error codes on this charming little machine are retrieved by using the error code to index into an array in ROM that looks like NFSNRG... and so on, so all error codes must be exactly 2 characters. With the 7 extra characters taken into account, all error messages will always be 9 bytes and hence 10 bytes is the shortest possible on this machine.
This is just one way to do it; there are countless more. It generates error 2, code SN, which means syntax error.
Bash, 29 bytes
true&&false||false||a
error message:
a: command not found
it's really just filler of bash builtins before using an undefined command. This was the shortest bash error message I could think of.
ZX Spectrum Basic, 9 bytes
RUN USR 8
produces:

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.
Ruby, 25 bytes
That was a fun exercise, thanks! There's probably a way to get a shorter error message with a SegFault, but I couldn't find any.
/\x
# Invalid hexa regexp
Error message:
a:1: invalid hex escape
24 bytes, including a trailing newline.
Ruby, 26 bytes
Here's my previous answer:
08
# No 8 allowed in octal
Error message:
a:1: Invalid octal digit
25 bytes, including a trailing newline.
Javascript 79 bytes
clear(this);
a=0;
typein:2: TyperError: attempt to run compile-and-go script on a
Applesoft BASIC, 14 bytes
SYNTAX ERROR??
Output:
?SYNTAX ERROR
GW-BASIC, 13 bytes
-------------
Error (12 bytes):
Syntax error
As GW-BASIC treats anything it doesn't recognize as a syntax error, there are a near-infinite amount of strings of length 13 that I could've used instead of -------------
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).
Mathematica kernel, 36 bytes
ClearAll[f];(*Space Filler*)On[f::f]
and the error is 35 bytes:
(linebreak)On::none: Message f::f not found.(linebreak)
4, 14 bytes
3.141592653589
All 4 programs must start with 3. and end with 4.
Provides as error (when run with the provided python interpreter)
Code invalid.
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.
Perl 5, 11 bytes
Since I'm not clear on whether my other answer obeys the challenge rules, here's another alternative.
#line 0
die
Error output:
Died.
With an ending newline, for 6 bytes.
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.
ed, 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. So unless the question is changed, I’m going to include it.
Code (with trailing newline):
??
Error (with trailing newline):
?
Casio Basic, 10 bytes
{}=>a:a[1]
or, for 12 bytes:
seq(x,x,1,0)
Error for both (6 bytes):
Domain
For the first one, accessing a list element outside the length of the list throws a Domain error. But for some weird reason, you can't access a list index in one go; that is, {}[1] is invalid syntax.
seq generates a list of values for a function with values in a given range; but in this case, specifying a range of 1 to 0 causes a Domain error, since the end is smaller than the start.
Batch, 24 23 bytes
@dir /
Outputs the following 23 22-byte error (as calculated by redirecting the output to a file):
Invalid switch - "".
Edit: Saved 1 byte by not having a switch character at all.
Mathematica, 120 bytes
"Take it easy my brother JungHwan Min,Take it easy my brother LegionMammal978,Take it easy my brother Charlie"*666*666/0
error-> Power::infy: Infinite expression 1/0 encountered.
see comments for details...
C (Modern Linux), 19 bytes
I suggested this in chat, but nobody took the oppurtunity. :P Credit to MD XF's hilarious answer.
main(){puts('s');;}
Error message, 18 bytes
Segmentation fault
Python 3, 67 bytes
`
File ".code.tio", line 1
^`````
SyntaxError: invalid syntax
Error Message, 66 bytes
File ".code.tio", line 1
`
^
SyntaxError: invalid syntax
2Col, 50 bytes
Invalid code!
Line 0 contains invalid 2Col code!
1
Outputs:
Invalid code!
Line 0 contains invalid 2Col code!
With a trailing newline.
Explanation
2Col only really has 1 error, and it's caused by the structure of the code being wrong. 2Col expects every line to be exactly 2 characters long, so if a line is longer or shorter than that, you get the above error.
Given that for this challenge the code must be longer than the error, the easiest way to achieve that is to use the error itself and add a byte.
Python 2, 67 bytes
b(h)#This has to be 67 characters. Thus, I'm writing this bullshit.
Error message, 66 bytes
File ".", line 1, in <module>
NameError: name 'b' is not defined
Note: doesn't work on TIO. Gives a longer error message. Try Python 2.7.13 on a local machine from stdin.
C/*nix, 13 bytes
f(){free(f);}
On minimalist/old systems and shells that don't do fancy things, this prints:
Aborted
Of course, most modern shells print things like:
*** Error in `/tmp/file': munmap_chunk(): invalid pointer: 0x0000000000400536 ***
Aborted
TryItOnline prints a whole host of information.
Ly, 77 bytes
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
Outputs:
Error occurred during parsing
SyntaxError: unmatched [] brackets in program
(note the trailing newline)
Tcl, 15
if 1234567890/0
outputs
divide by zero
Tcl/Tk, 19
pack [text .text 1]
outputs
18
unknown option "1"
TryAPL, 11 bytes
Code (11):
'abcdefghij
Error (10):
open quote
Japt, 32 bytes
????????????????????????????????
Error message (31 bytes):
SyntaxError: Unexpected token ?
Aubergine, 53 bytes
0/0 Lots of wasted space. I don't know how Aubergine.
Outputs SyntaxError: Invalid instruction (0) at character 0.
C (modern Linux), 19 bytes
Would've done my famous segfault but totallyhuman stole it.
main(){longjmp(0);}
Output (18 bytes):
Segmentation fault
Taxi, 38 21 bytes
Switch to plan "abc".
Produces:
error: no such label
-17 bytes thanks to Engineer Toast
Tries to switch to "abc", which does not exist. You would have [abc] somewhere.
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>>
C++ 133 bytes
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[]){
printf("%s", variable);
return 0;
}
Displays the error (132 bytes):
.code.tio.c: In function ‘main’: .code.tio.c:5:14: error: ‘variable’ undeclared (first use in this function) printf("%s", variable);
Brain-Flak (BrainHack), 43 + 3 = 46 bytes
([()])()()()()()()()()()()()()()()()()()()-
Produces the error
BrainHack: Prelude.chr: bad argument: (-1)
Lua, 45 bytes
0/###########################################
Error message, 44 bytes
lua: .code.tio:1: unexpected symbol near '0'
Bash, 20 bytes
"" # waste of space!
Outputs : command not found.
Bash, 21 bytes
b # let's waste space
Outputs: b: command not found.
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 READs than DATAs 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 ...
Python 2, 35 bytes
import sys;sys.tracebacklimit=000;a
Gives error:
NameError: name 'a' is not defined
J, 10 bytes
0000000^.0
NaN error <-------- length 9
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.
Brain-Flak, 46 bytes
))))))))))))))))))))))))))))))))))))))))))))))
This prints
Error at character 0: Unopened ')' character.
because in Brain-flak, all brackets must be balanced for the program to be valid.
Python 3, 71 bytes
a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=A=B=C=D=E=F=1#
is=0
File ".code.tio", line 2
is=0
^
SyntaxError: invalid syntax
Brainf**k, 17 bytes, this interpreter
+++++++++++++++<<
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
Add++, 20 bytes
+?
Needed to be long
Error is Error encountered! followed by a newline, which is 19 bytes long. This happens because it tries to take input, but fails as there is no input.
><>, 26 bytes
>>>>>>>>>>>>>>>>>>>>>>>>>:
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.
