g | x | w | all
Bytes Lang Time Link
003Vyxal240906T111523Zemanresu
039Swift 5.9.2240301T170030ZmacOSist
017Bespoke250125T050353ZJosiah W
012Emojigramming240512T012649ZNone1
065Pip240509T063026ZDLosc
019C Linux240509T055922Zntfs.har
014Bash240508T200401Zcnamejj
067Go240227T154756Zbigyihsu
038YASEPL240227T154130Zmadeforl
020/bin/sh "dash" on Ubuntu Bionic201224T045533Zcnamejj
038Vyxal 3240227T143753Zpacman25
012Setanta230720T081219Zbb94
038Raku Perl 6 rakudo230720T080621Zbb94
029Python 3230719T143839ZThe Empt
027Javascript Firefox170722T141354ZSuperSto
019Whitespace wspace 0.3220103T061050Zthaliaar
035Python220102T192839ZCaelus
071CPython 3.9220101T085947Zpxeger
017Vim211223T151700ZAaroneou
057Rust201117T202501ZAiden4
047COBOLGNU210607T190939Zsmarnav
309Vyxal210105T081604Zlyxal
038naz210101T064001Zsporebal
016C201224T153259ZEasyasPi
41105AB1E201117T004255ZMakonede
100Shakespeare Programming Language201216T221602ZHello Go
029Red201117T212300ZFighting
026GNU Smalltalk190910T190403Zuser1525
030Python190910T182010ZSagittar
059C# .NET190820T173344Zcanttalk
029@190810T182029Zuser8505
050Loader181019T121550ZSuperJed
048Coconut181018T155020ZCitty
009IE9 Chinese version181017T185219Zl4m2
002Sinclair ZX81171113T132513ZShaun Be
003ed180704T111336Znull
048Shakespeare Programming Language180627T002551ZJo King
034Whitespace on TIO180627T125714ZKevin Cr
011SmileBASIC console171024T163240Z12Me21
029F#180626T203342ZCiaran_M
073Shakespeare Programming Language170726T171658ZMaya
036Go180626T214528Zlukass
009TIBasic170722T011533ZTimtech
040Attache180626T192332ZConor O&
020Julia 0.6 REPL/e180626T185235ZSundar R
022Japt170721T204207ZShaggy
041Aceto171225T171414Zqqq
013JavaScript171024T160042Zuser7520
028Octave171109T130505ZStewie G
056PHP170722T164330Zrexkogit
017Eukleides171024T180721Zbrhfl
018Batch170723T015031Zuser6318
026><>170727T234229Zjellies
025C# .Net170727T155207ZTehPers
019Vim170727T152743Zjacwah
185dc GNU 1.2 on Windows 10 x64170726T175356Zjuh
150ArnoldC170724T175920ZTemporal
043MATLAB170726T113720ZTom Carp
nanJAVA 8170726T095635ZXtremeBa
047PHP170726T024130Zmanasseh
069Groovy170725T191106ZFels
028R170721T192629ZGiuseppe
021JavaScript Firefox170721T204754ZOliver
2625Prolog SWI170725T125318ZFatalize
009BASIC BBC micro170725T123038ZBaldrick
009R170725T104801Zjochen
030TrumpScript170725T012430ZTimtech
029VBA170722T172309ZTaylor R
043Java 7170724T171834ZPoke
nanC++ MinGW + GCC + Windows170724T165008ZKeyu Gan
026C++170724T161031ZRobert A
024Javascript V8170724T125128ZMax Sine
189PowerShell170721T193350ZAdmBorkB
054Braingolf170724T083824ZMayube
046C#170724T080707ZTheLetha
007LibreOffice Calc170724T055644Ztsh
025Rexx Regina170724T054038Ztheblitz
023C++ on macOS High Sierra beta170724T034249Zfluffy
079Python 2170721T190202Ztotallyh
032Ruby170721T195255Zameketa
009GWBasic170723T185745ZAnonymou
010TRS80 Model 100 Basic170723T182248ZAnonymou
029Bash170723T145931ZJoshRage
009ZX Spectrum Basic170723T080117ZRadovan
025Ruby170722T195538ZEric Dum
079Javascript170723T020451Zuser6318
021ExtraC170723T015726Zuser6318
014Applesoft BASIC170723T005308ZMD XF
013GWBASIC170723T005001ZMD XF
015Commodore 64 Basic170723T002310ZMark
036Mathematica kernel170722T032253ZJungHwan
0144170722T212903ZUriel
025System V shell170721T204424ZMD XF
011Perl 5170722T173228Zascheple
003ed170721T200612ZAnders K
010Casio Basic170722T140631Znumberma
023Batch170722T002210ZNeil
120Mathematica170721T192028ZZaMoC
019C Modern Linux170721T195005Ztotallyh
067Python 3170721T191528Z0xffcour
0502Col170722T093802ZMayube
067Python 2170721T194704ZKoishore
013C/*nix170722T033820ZMD XF
077Ly170722T030340ZLyricLy
005Perl 5170722T011502Zascheple
015Tcl170722T005057Zsergiol
019Tcl/Tk170721T231441Zsergiol
011TryAPL170721T194332ZAdalynn
032Japt170721T202656ZOliver
053Aubergine170721T202216Zuser5882
019C modern Linux170721T202148ZMD XF
021Taxi170721T191934ZStephen
021Haystack170721T201207Zuser5882
024Zsh170721T195931Zuser5882
013Haskell170721T195720ZAnders K
133C++170721T192157ZIvan Bot
nanBrainFlak BrainHack170721T195444ZWheat Wi
045Lua170721T195312Z0xffcour
020Bash170721T195211Zuser5882
011QBasic170721T194452Zsteenber
035Python 2170721T194422Zorlp
010J170721T193852ZRichard
020Common Lisp170721T192910ZCheldon
031JavaScript Firefox170721T192158ZETHprodu
046BrainFlak170721T191742ZDJMcMayh
071Python 3170721T191631Zhyperneu
017Brainf**k170721T191203Zhyperneu
020Add++170721T191103Zcaird co
026><>170721T190730Zhyperneu

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 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
:

Try the fiddle!

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.

Try it online!

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.

Attempt This Online!

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

Try it online!

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"}

Attempt This Online!

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.

Vyxal 3, 38 bytes

222222222222222222222222222222222222[x

Try it Online!

RuntimeException: Too many recursions

Setanta, 12 bytes

1/0 >--- uwu

This produces the 11-byte error message Roinnt ar 0.

Try it here

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


Attempt This Online!

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)

Try it online!

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 {

Try it online!

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(())}

Try it online!

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


:)

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

Shakespeare Programming Language, 100 bytes

,.Ajax,.Puck,.Act I:.Scene I:.[Enter Ajax and Puck]Ajax:You cat!You is the quotient betweenyou zero.

Try it online!

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

Try it online!

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.

ZX81 Undefined Variable error

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

Try it online!

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!

Try it online!

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!

Try it online.

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.

Try it online!

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!!!

Try it online!

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

Test it

Aceto, 41 bytes

                                        &

Try it online!

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)

Try it online!

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?

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

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, 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!

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:

a​aaaaaa={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.

Try it online!

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.

Try it online!

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.

TrumpScript, 30 bytes

We love NATO!
America is great

Error message:

Trump doesn't want to hear it

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.

Try it online!

Note that TIO expands the error message.

PowerShell, 215 189 bytes

[]
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

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 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/

Try it online!

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"&@@

Try it online!

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

Try it online!

"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

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

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:

Error message

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.

Try it online!

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

ExtraC, 21 bytes

Invalid character: : 

Try it online!

If you remove the space after the second :it is a error quine

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.

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.

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

Try it online!

Error Message, 66 bytes

  File ".code.tio", line 1
    `
    ^
SyntaxError: invalid syntax

2Col, 50 bytes

Invalid code!
Line 0 contains invalid 2Col code!
1

Try it on 2ColIDE

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)

Perl 5, 5 bytes

die$/

Outputs a newline, for one byte.

Try it online!

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 ?

Try it online!

Aubergine, 53 bytes

0/0 Lots of wasted space. I don't know how Aubergine.

Outputs SyntaxError: Invalid instruction (0) at character 0.

Try it online!

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

Try it online!

-17 bytes thanks to Engineer Toast

Tries to switch to "abc", which does not exist. You would have [abc] somewhere.

Haystack, 21 bytes

Wasted space is good!

Errors with Where's the needle?. Dosen't work on TIO.

Zsh, 24 bytes

"" #lots of wasted space

Outputs zsh: permission denied:.

Try it online!

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

([()])()()()()()()()()()()()()()()()()()()-

Try it online!

Produces the error

BrainHack: Prelude.chr: bad argument: (-1)

Lua, 45 bytes

0/###########################################

Try it online!

Error message, 44 bytes

lua: .code.tio:1: unexpected symbol near '0'

Bash, 20 bytes

"" # waste of space!

Outputs : command not found.

Try it online!

Bash, 21 bytes

b # let's waste space

Outputs: b: command not found.

Try it online!

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

Common Lisp, 20 bytes

(/ 1 0))))))))))))))

Try it online!

Error Message

/: division by zero

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

))))))))))))))))))))))))))))))))))))))))))))))

Try it online!

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

Try it online!

  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

Try it online!

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

>>>>>>>>>>>>>>>>>>>>>>>>>:

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.