g | x | w | all
Bytes Lang Time Link
nan250702T111248ZSteve Be
018Vyxal 3.7.0250701T180554Zpacman25
123CASIO BASIC CASIO fx9750GIII250204T193547Zmadeforl
043Bespoke250125T052325ZJosiah W
nanperl240618T122055ZThemooni
070Emojigramming240615T064210ZNone1
nan240615T062619ZNone1
043LOLCODE240212T220707ZAdelie
998Perl 5240227T200311ZDom Hast
nan240214T144900Zmadeforl
nan230815T125423ZEarldrid
070Applescript230719T195840ZJakdad J
038230602T173855ZDadsdy
127MirBSD pax230524T113747Z鳴神裁四点一号
105Python 3230504T004228ZJakdad J
nan230503T193931ZJakdad J
nan230503T180539ZThe Empt
nan230503T144238ZNot A Ch
066xidoc230503T142239ZAdam
nan230228T024756ZInfigon
nan230103T215945Zqarz
007ACCUMULATOR230103T075530ZRhaixer
157gpg GnuPG 2.2.40221027T024701Z鳴神裁四点一号
nanFig221018T204602ZSeggan
032Knight v2 + EVAL knightlang.netlify.app implementation221019T011026ZAiden Ch
041Desmos221019T001027ZAiden Ch
nan140905T200248ZMark
024TIBasic210928T130221ZMarcMush
079PPL210911T143714Zophact
021Phooey210623T000139ZEasyasPi
095Agda210622T153706Zcpli
042Vyxal210529T030341Zemanresu
020Grok210518T205450ZAaroneou
nanPxem pxemi.2.min.posixism210326T083643Zuser1004
nan210221T100132Zemanresu
035m4 before 1.4.183 Termux patch210126T192906ZEasyasPi
nan201118T060953ZBaseZen
039Husk201019T235623ZLegionMa
097Setanta200826T125943Zbb94
nan200804T203504ZTehPers
nan200519T090706ZIFcoltra
nan200517T191537ZLuvexina
070Turing Machine Code200516T170249Zouflak
009Pepe181030T022819Zu-ndefin
064MS SQL Server version 2012191004T123151Zsteenber
nanPiet191004T120301ZAlienAtS
042C tcc191002T111656ZS.S. Ann
038ESOPUNK181010T173220ZSIGSTACK
nan190827T140053Zuser8505
nan170507T020939Zuser6213
nan150522T031713ZDennis
nan150831T202912ZSuperJed
071Pip190718T140119ZKenzie
nan190719T051156ZTheOnlyM
253W.Y.A.L.H.E.I.N.190617T222024ZMilkyWay
046Triangularity190617T221520ZMilkyWay
121Snowman190331T161642ZMilkyWay
nan180316T193929Zweatherm
020ZSH macOS190323T003328ZJosh Pri
065ink190322T031011ZSara J
258Turing Machine But Way Worse190322T004407ZMilkyWay
nan140817T152246Zproud ha
nanRust180218T142829Znull
nan190224T033140ZMilkyWay
039Javascript Chrome/V8170830T200235ZSasha
002K ngn/k181011T014221ZThaufeki
032VB.Net180905T133934Zseadoggi
032Malbolge180226T070548ZWeijun Z
028Python 3180218T194720ZDat
248Windows .EXE170530T212426ZMD XF
094Cubically170618T194711ZMD XF
nan140816T201543ZFlorian
090INTERCALL161222T135620ZErik the
nan140816T202040ZBenjiWie
003Python171113T185253Zaaay aaa
nan170827T215719ZObsequio
045NASM for x86170827T212606Zuser2330
007Recursiva170826T162328Z0xffcour
nank170618T214500Zzgrep
nan170618T213409Zzgrep
048KSH script170530T184135ZMD XF
202Syms170528T015225ZCalculat
nan170521T234425Zfelixphe
nan170514T165359Zeush77
012GWBASIC least170506T224307ZMD XF
066MATLAB170410T083451ZStewie G
nan170410T055709Z0xffcour
nan170128T023411ZSuperJed
nan170127T234030ZNick the
nan170119T005248Zsnail_
nan170117T180633Zquat
028ArnoldC170106T012309ZRiker
nan161012T175428ZMagic Oc
nan161012T185700ZLambdaBe
036Codelike161011T185351ZConnor D
nan161011T081516Znjpipeor
nan140820T003648ZJames
nan161008T112938ZFinW
nan161008T120036ZDavid Co
nan161008T115018ZDavid Co
nan161008T114830ZDavid Co
nan160915T144603ZTuxCraft
070BBC Basic140818T235740ZLevel Ri
nan160518T002757Zcat
012CJam160221T145649Zusername
nan151102T155031ZAddison
nan140919T235157Zjimmy230
nan140816T101200ZMark
nan151015T010559ZMama Fun
nan151015T005126Zuser4616
nan150403T135355ZASCIIThe
025><> 25 Bytes140818T153947ZCruncher
nan150902T013408ZThe_Bass
nan150411T042435ZDigital
nanJava150531T150446Zaditsu q
nan150410T233718Zmbomb007
nan150402T205914ZLuke
nan150402T204531ZASCIIThe
nan140905T194020ZDennis
nan140819T194123Zshadowta
001Ed140816T161338ZIan D. S
nan140818T175402ZHostileF
nan140818T214949ZDarkAjax
nanJava 8 compilation error quine140818T213610ZVolune
nan140818T161102Zfvla
nan140818T075728ZΟurous
nan140817T191538ZDanko Du
035Lua console140817T105610ZMartin E
nan140816T145346ZFalko
nanCoffeeScript140816T092015ZMartin E
032Bash140816T134659ZIngo B&#
nan140816T093151Zrink.att
nan140816T072851ZFalko
nan140816T091514Zrink.att
nan140816T090517ZMartin E
nan140816T083113ZAndoDaan
nan140816T083010Zrink.att
nan140816T072831ZHoward

Node v22

[stdin]:1
[stdin]:1
       ^

SyntaxError: Unexpected token ':'
    at makeContextifyScript (node:internal/vm:185:14)
    at node:internal/process/execution:107:22
    at [stdin]-wrapper:6:24
    at runScript (node:internal/process/execution:101:62)
    at evalScript (node:internal/process/execution:136:3)
    at node:internal/main/eval_stdin:32:5
    at ReadStream.<anonymous> (node:internal/process/execution:237:5)
    at ReadStream.emit (node:events:520:28)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Node.js v22.7.0

Running from stdin like this:

$ node <<EOF
> [stdin]:1
> [stdin]:1
>        ^
>
> SyntaxError: Unexpected token ':'
>     at makeContextifyScript (node:internal/vm:185:14)
>     at node:internal/process/execution:107:22
>     at [stdin]-wrapper:6:24
>     at runScript (node:internal/process/execution:101:62)
>     at evalScript (node:internal/process/execution:136:3)
>     at node:internal/main/eval_stdin:32:5
>     at ReadStream.<anonymous> (node:internal/process/execution:237:5)
>     at ReadStream.emit (node:events:520:28)
>     at endReadableNT (node:internal/streams/readable:1696:12)
>     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
>
> Node.js v22.7.0
> EOF
[stdin]:1
[stdin]:1
       ^

SyntaxError: Unexpected token ':'
    at makeContextifyScript (node:internal/vm:185:14)
    at node:internal/process/execution:107:22
    at [stdin]-wrapper:6:24
    at runScript (node:internal/process/execution:101:62)
    at evalScript (node:internal/process/execution:136:3)
    at node:internal/main/eval_stdin:32:5
    at ReadStream.<anonymous> (node:internal/process/execution:237:5)
    at ReadStream.emit (node:events:520:28)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Node.js v22.7.0

Or similarly from a file:

/Users/me/foo.js:1
/Users/me/foo.js:1
^

SyntaxError: Invalid regular expression flags
    at wrapSafe (node:internal/modules/cjs/loader:1469:18)
    at Module._compile (node:internal/modules/cjs/loader:1491:20)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5)
    at node:internal/main/run_main_module:30:49

Node.js v22.7.0
```

Vyxal 3.7.0, 18 bytes

No such element: #

Vyxal It Online!

Any runtime error will result in a massive stack trace from scala, so we have to go with a parsing error. Easy enough, just use a digraph prefix with nothing after it. Except that all other digraphs give a stack trace due to unknown lexer error, so # is the only one that works here.

CASIO BASIC (CASIO fx-9750GIII), 12 bytes!! :3

Syntax ERROR

I'm not sure if this counts or not

Bespoke, 43 bytes

Specifier was expected, but none found: '5'

The only possible error quine in Bespoke.

This program is equivalent to the following "mnemonic" representation:

CONTINUED XXX:INTEIGHT TRI FOUR
INPUT

The reference interpreter performs two steps before interpreting Bespoke code: tokenizing and parsing.

The CONTINUED instruction isn't valid at the very start of the program, which would normally lead to an Unexpected CONTINUED number. error; however, that would only get caught in the parsing step.

The INPUT instruction expects a specifier after it (which specifies what type of input it takes - a number or a character); the tokenizing step catches that no such specifier was found.

perl, 42 + 6 (file name) = 48 bytes

Illegal division by zero at /tmp/p line 1.

Try it online!

Save as contents of /tmp/p and run perl /tmp/p

Marking as community wiki because I did not come up with it, I saw it in this answer. I wanted to include it because I think it's beautiful.

explanation:

By default, text that doesn't parse as an expression in perl is treated as an unquoted string. This meants that at and tmp are just literal strings, and the / in between makes perl try to parse the division 'at'/'tmp'. Since both of them contain no numers, type coercion evaluates both of them to be 0, and obviously you can't divide by zero.

Emoji-gramming, 70 bytes

💻  ⚠️ ➡️ 🚨  3
🚫 🔡 ➡️ 🔲 🔳 
😇    
None

Try it online!

Note that there are 4 spaces after 😇 and a line feed in the end. This is the error when Emoji-gramming sees invalid characters in a valid command.

Brainfuck (qdb)

unbalanced [.

This is the error message qdb prints when there are more ['s than ]'s.

Try it online!

LOLCODE, 43 bytes

.code.tio:1: unknown token at: .code.tio:1:

Try it online!

Uiua, 95 bytes SBCS

Error: Unexpected token |
  at 1:25
1 | Error: Unexpected token |
                            ─

Try it online!

Perl 5, 99 bytes code + 8 bytes file path, 107 bytes

File must be named >>;/\1/a to close off the <-- HERE ... <-- HERE and to reference the nonexistent group in a regex.

Link is to a Bash test suite.

Reference to nonexistent group in regex; marked by <-- HERE in m/\1 <-- HERE / at >>;/\1/a line 1.

Try it online!

YASEPL

ERROR 5 no variable is loaded:(

located at :

very simple

Taxi

error: parse error: likely incomplete statement

Try it online!

Applescript, 70 bytes

0:2: syntax error: A “:” can’t go after this identifier. (-2740)

Run with osascript -e "0:2: syntax error: A “:” can’t go after this identifier. (-2740)"

(,) 38 Bytes

code must be surrounded by parentheses

Litterally the only possible one on my current interpreter

MirBSD pax, 127 bytes.

Includes trailing newline:

pax: End of archive volume 1 reached
pax: Cannot identify format. Searching...
pax: Sorry, unable to determine archive format.

Usage

$ pax -f quine 
pax: End of archive volume 1 reached
pax: Cannot identify format. Searching...
pax: Sorry, unable to determine archive format.
$ pax < quine 
pax: End of archive volume 1 reached
pax: Cannot identify format. Searching...
pax: Sorry, unable to determine archive format.
$

Python 3, 105 bytes

  File ".code.tio", line 1
        File ".code.tio", line 1
        ^
IndentationError: unexpected indent

Try it online!

Desmos

Sorry, I don't understand the '"' symbol.

https://www.desmos.com/calculator/q0w3njcgxe

Python 3 (IDLE)

SyntaxError: incomplete input

This surprisingly outputs just itself and nothing else.

Desmos

Sorry, I don't understand the '&' symbol.

Go to desmos.com/calculator and paste in the "code".

xidoc, 66 bytes

Error while rendering file 
at 2:17-2:18 in []
Command not found: 

xidoc, 135 bytes

Error while rendering file 
at 3:26-3:26
Parse error: Unexpected ']'
3 │ Parse error: Unexpected ']'
  │                          ^

Try it (you need to paste in the code)

JavaScript

Thought I would make an updated JS answer.

Firefox:

Uncaught SyntaxError: unexpected token: identifier
Google Chrome:
Uncaught SyntaxError: Unexpected identifier 'SyntaxError'

Snap! (scratchblocks syntax)

Hmm...
a custom block definition is missing

ACCUMULATOR, 7 bytes

Invalid

Invalid is the only error in ACCUMULATOR. This is because I is not a function in ACCUMULATOR.

gpg (GnuPG) 2.2.40, 157 bytes

Note error is followed by a newline.

gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: no valid OpenPGP data found.
gpg: processing message failed: Unknown system error

Usage in shell

I don't know if that source is REALLY a program source.

cat <<'X' >source
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: no valid OpenPGP data found.
gpg: processing message failed: Unknown system error
X
gpg <source >stdout 2>stderr
cat stdout
diff source stderr

Fig, 1292 bytes (UTF-8)

DEBUG:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "x" is null
    at clojure.lang.Numbers.ops(Numbers.java:1068)
    at clojure.lang.Numbers.incP(Numbers.java:141)
    at fig.compression$fromBijectiveBase$fn__191.invoke(compression.clj:26)
    at clojure.core.protocols$fn__8181.invokeStatic(protocols.clj:168)
    at clojure.core.protocols$fn__8181.invoke(protocols.clj:124)
    at clojure.core.protocols$fn__8136$G__8131__8145.invoke(protocols.clj:19)
    at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
    at clojure.core.protocols$fn__8168.invokeStatic(protocols.clj:75)
    at clojure.core.protocols$fn__8168.invoke(protocols.clj:75)
    at clojure.core.protocols$fn__8110$G__8105__8123.invoke(protocols.clj:13)
    at clojure.core$reduce.invokeStatic(core.clj:6830)
    at fig.compression$fromBijectiveBase.invokeStatic(compression.clj:26)
    at fig.compression$decompress.invokeStatic(compression.clj:39)
    at fig.compression$decompress.invoke(compression.clj:35)
    at fig.compression$decompress.invokeStatic(compression.clj:36)
    at fig.parsing$lex.invokeStatic(parsing.clj:40)
    at fig.core$_main.invokeStatic(core.clj:38)
    at fig.core$_main.doInvoke(core.clj:19)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at fig.core.main(Unknown Source)

Try it online!

The tabs sadly disable Fig's scoring system, so this is counted in UTF-8/ASCII. Still no normal Fig quine...

Knight (v2 + EVAL) (knight-lang.netlify.app implementation), 32 bytes

Error: Unknown identifier 'rror'

Try it online!

Different implementations handle errors differently (it is undefined behavior in the official specs), which is why I specified the implementation that I'm using.

Also, this technically only works in version 1.x because EVAL is removed as a required function in the v2 official specs, but this implementation has EVAL even though it is a v2 implementation, which is why I specified EVAL in the header just to be safe.

If EVAL wasn't implemented in this implementation, I think something like Error: No value could be parsed! would be a valid error quine instead (and it coincidentally turns out to also be 32 bytes).

Knight (v1.2) (C (gcc) implementation), 21 bytes

invalid character 'i'

Try it online!

Different implementation, different error messages :)

Desmos, 41 bytes

Sorry, I don't understand the '?' symbol.

Try It On Desmos!

Hover over the danger sign to view the error message.

There could be something shorter but I don't have time to go through every single error out there in Desmos lol.

Z-machine interpreter

I don't know the word "know".

Test against this popular interpreter. Also there's some sort of mostly harmless game hosted there.

TI-Basic, 24 bytes

ERR:SYNTAX
1:Quit
2:Goto

lowercase characters outside strings are a syntax error

screenshot of the error

PPL, 79 bytes

Reference error on line 3, column 3

  a()
  ^

The identifier a is not defined

I haven't implemented syntax checking properly, so only reference errors and type errors are thrown (plus syntax checking in rare cases). Pretty simple answer, frankly. Attempts to call the nonexisting a function (just a without the call does not work because my interpreter does not check for invalid expressions in some cases) I know my language is not very good but I'm too lazy to work on it.

Phooey, 21 bytes

Unknown mode for '$'

Try it online!

Phooey ignores Unknown mode for ', then tries to parse $' which is an unknown mode for $. 😂

Agda, 95 bytes

After a few attempts, I finally found a solution in my favorite dependently typed language! Agda includes the full filename in place of error.agda on lines 1 & 2.

error.agda:3,1-1
error.agda:3,1: Parse error
)<ERROR>
<ERROR>
<ERROR>
<ERROR>
<ERROR...

Save file as error.agda and prepend the full filepath on those first two lines for a local answer, or here: Try it online!

Vyxal, 42 bytes

slice expected at least 1 arguments, got 0

Try it Online!

Grok, 20 bytes

You don't grok Grok.

Try it Online!

Grok has only one error message, and one of the ways to trigger it is to try to execute an invalid command. In this case, oun'tgrG. are all invalid commands, so when the execution reaches the first o, it errors out, printing the source code.

Pxem (pxemi.2.min.posixism), Filename: 14 bytes + Content: 0 bytes = 14 bytes.

Try it online!

Brain-flak

Error at character 33: Unclosed '(' character.

Try it online!

Haskell

[1 of 1] Compiling Main             ( .code.tio.hs, .code.tio.o )

.code.tio.hs:1:4: error: parse error on input ‘of’
  |
1 | [1 of 1] Compiling Main             ( .code.tio.hs, .code.tio.o )
  |    ^^
/srv/wrappers/haskell: line 5: ./.bin.tio: No such file or directory

Try it online!

Stack Cats

Error: invalid character in source code, E | E ,edoc ecruos ni retcarahc dilavni :rorrE

Try it online!

Taxi

error: parse error: likely incomplete statement

Try it online!

Hexadecimal Stacking Pseudo-Assembly language

/opt/hspal/hspal.rb:69:in `run': Illegal opcode: 170  (RuntimeError)
    from /opt/hspal/hspal.rb:75:in `<main>'

Try it online!

Quarterstaff

Traceback (most recent call last):
  File "/opt/quarterstaff/quarterstaff.py", line 142, in <module>
    QuarterstaffInterpreter(open(parser.parse_args().program).read())
  File "/opt/quarterstaff/quarterstaff.py", line 7, in __init__
    self.run(self.parse(program), {}, 0)
  File "/opt/quarterstaff/quarterstaff.py", line 35, in parse
    raise Exception
Exception

Try it online!

Haxe

Main.hx:1: characters 0-4 : Unexpected Main
Uncaught exception - load.c(181) : Module not found : .bin.tio

Try it online!

Hasm

Error with instruction <internal{PARSE}> on line 0:
    Syntax error or illegal instruction: Error with instruction <internal{PARSE}> on line 0:
Dumping core:


STACK:
    
OFFSTACK:
    
HEAP:
    0 

Try it online!

Mornington Crescent

Traceback (most recent call last):
  File "/opt/mornington-crescent/esoterpret.py", line 123, in <module>
    arguments.stdin, extra)
  File "/opt/mornington-crescent/esoterpret.py", line 41, in use_language
    while not(interpreter.has_execution_finished()):
  File "/opt/mornington-crescent/modules/morningtoncrescent/morningtoncrescent.py", line 50, in has_execution_finished
    raise RuntimeError("You have to end at Mornington Crescent.")
RuntimeError: You have to end at Mornington Crescent.

Try it online!

Muriel

*** ERROR: muriel: Unknown token '*'

Try it online!

Just picked some random esolangs from TIO and keyboard hashed until I got an error, then copy + pasted.

m4 (before 1.4.18-3 Termux patch), Termux, Android 11, 35 bytes

Who said the error had to be caused directly?

FORTIFY: %n not allowed on Android

Includes trailing newline.

m4 uses a very old version of Gnulib.

Since Android doesn't support %n in printf, Gnulib will replace every printf function in libc with its own custom implementation.

However, stupidly, said function will still use libc's snprintf function internally (which it is supposedly trying to replace because it doesn't work 🤔), and when using it, it attempts to use %n every single time it is called, even if %n isn't in the original format string.

%n used to be silently ignored on Android (similar to macOS), but Android 11 made these errors fatal, causing this error to be printed followed by abort().

I used set +m to prevent Bash from printing the signal error, and I had to compile from source to undo the -3 patch.

The file itself doesn't matter: m4 is guaranteed to crash no matter what. This includes running with no arguments.

See this Github issue

enter image description here

Swift

This is a bit of a stretch. Bear with me.

The source MUST be encoded as UTF-16. Formatting the following as UTF-16:

swift.swift:1:1: error: input files must be encoded as UTF-8 instead of UTF-16
??^@s^@w^@i^@f^@t^@.^@s^@w^@i^@f^@t^@:^@1^@:^@1^@:^@ ^@e^@r^@r^@o^@r^@:^@^@i^@n^@p^@u^@t^@ ^@f^@i^@l^@e^@s^@ ^@m^@u^@s^@t^@ ^@b^@e^@\^@e^@n^@c^@o^@d^@e^@d^@ ^@a^@s^@ ^@U^@T^@F^@-^@8^@ ^@i^@n^@s^@t^@e^@a^@d^@ ^@o^@f^@ ^@U^@T^@F^@-^@1^@6^@

where ^@ is emacs-speak for an embedded NUL and the ? characters are genuine ASCII question marks. Outputting to console (cat doesn't work, being ignorant of UTF16):

$ iconv -f utf-16 swift.swift

swift.swift:1:1: error: input files must be encoded as UTF-8 instead of UTF-16
??swift.swift:1:1: error: input files must be encoded as UTF-8 instead of UTF-16

and compiling:

$ swiftc swift.swift

We get:

swift.swift:1:1: error: input files must be encoded as UTF-8 instead of UTF-16
??swift.swift:1:1: error: input files must be encoded as UTF-8 instead of UTF-16

As desired.

CAVEATS:

I'm claiming it's a quine as long as the source is rendered with a UTF-16 aware output utility and a terminal that discards ANSI formatting, NULs, and degrades unprintable characters to ?.

USING TextEdit

You can also make a more visually convincing argument using ˛ˇ in place of ?? where you keep the input as UTF-16 and let Swift output the (invalid) UTF-8 output with swiftc swift.swift > out 2>&1 and open out in TextEdit. Side by side, the input and output indeed are rendered identically. No less dubious under the covers, but looks a lot less dubious.

So...when you say exactly identical, what exactly do you mean?

If the output must be re-usable as the input, the quine constraint is indeed violated. And if you argue it's OK to cycle the UTF8 compiler output back to UTF16 source, that seems promising, but doesn't work because the output of swiftc is neither valid UTF-8 nor UTF-16: it is not valid to embed the BOM header midstream in either encoding. It's just terminal poo. Having fun yet?

It's an interesting foray into encoding and terminals, at the least!

Husk, 39 bytes

Could not infer valid type for program

Try it online! The infamous error that everyone is familiar with. Interestingly, I had trouble finding any other error quines: Parse error (missing \): ¶ is nearly one in verbose mode, but it outputs Parse error (missing \): ): ¶¶.

Setanta, 97 bytes

Eisceacht ar líne 1: Suíomh 19: Ag súil le uimhir, téacs, bool, athróg, liosta, nó gníomh.

Try it here!

Rust v1.45.2 (via Rust Playground)

Code (1126 bytes):

error: unknown start of token: `
 --> src/lib.rs:1:32
  |
1 | error: unknown start of token: `
  |                                ^
  |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
  |
1 | error: unknown start of token: '
  |                                ^

error: unknown start of token: `
 --> src/lib.rs:4:36
  |
4 | 1 | error: unknown start of token: `
  |                                    ^
  |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
  |
4 | 1 | error: unknown start of token: '
  |                                    ^

error: character constant must be escaped: '
 --> src/lib.rs:7:56
  |
7 | help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
  |                                                        ^

error: unterminated character literal
 --> src/lib.rs:9:36
  |
9 | 1 | error: unknown start of token: '
  |                                    ^

error: aborting due to 4 previous errors

error: could not compile `playground`.

Try it online (error message might differ in future versions of the language, though)

Compile errors in Rust all start with "error:", so copy/pasting the errors into the source a bunch of times eventually leads to these error messages. Default settings for the Rust Playground were used. That means 2018 edition, stable branch, and debug mode. I don't know what the target triple is.

Red 0.6.3

*** Error: not a Red program!

Newline included. Save as a .red file and run with red <filename>.red.

Julia 1.0 (Tio)

Implementation specific, but this one is made to run in Tio.

ERROR: LoadError: UndefVarError: syntax: extra token "token" after end of expression
Stacktrace:
 [1] include at ./boot.jl:317 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1038
 [3] include(::Module, ::String) at ./sysimg.jl:29
 [4] exec_options(::Base.JLOptions) at ./client.jl:229
 [5] _start() at ./client.jl:421
in expression starting at /home/runner/.code.tio:1

Try it online!

Turing Machine Code, 70 bytes

Syntax error on line 1: <current symbol> should be a single character!

Try it online!

Pepe, 9 bytes

RRRERROR!

Link to interpreter (paste the code above, permalink removes the ! and O)

Explanation:

The interpreter ignores characters other than R,r,E,e so the code is:

RRRERRR

Now to explain:

  RE    # Push 0
RR      # (RR flag: doesn't exist)
    RRR # There is no command RRR, so output RRRERROR!

MS SQL (Server version 2012), 64 bytes

Msg 2812, Level 16, State 62, Line 1
Incorrect syntax near '16'.

Piet, using npiet interpreter

cannot read from `Error.txt'; reason: unknown PPM format

Save as 'Error.txt' and put it in the same folder as the npiet executable. If you want to golf, you can of course choose a shorter filename and adjust the code to match.

C (tcc), 42 bytes

.code.tio.c:1: error: declaration expected

Try it online!

ESOPUNK, 38 bytes

Invalid instruction INVALID at line 0.

GNU Smalltalk REPL

REPL is always acceptable, and I only learned the Smalltalk REPL and don't know how to save programs in a file. (I think TIO does not have Smalltalk yet.)

stdin:1: expected expression

This will work when you start the REPL for the first time.

A Pear Tree

a partridge

Try it online!

Almost every program (that isn't very long) prints a partridge in A Pear Tree.

One of the goals of the language was to be good at challenges; as such, it tries to find a substring of the program that has a very specific property that rarely occurs by chance, and starts running the program there. If it can't find an appropriate entry point, it prints an error. The actual text of the error message was chosen for the The Twelve Days of Christmas reference. (Actually, the design for the language worked the other way round; the main goal was to have a language which errored out on almost any source code, so that it would make the reference in question, so I set about trying to work out what sort of language design would naturally end up doing that.)

Chicken

Error on line 1: expected 'chicken'

Loader (using the official Java interpreter):

These should be run from a module named main in order to produce the exact error messages given here.

This works in the most recent version of the interpreter:

Error: Could not evaluate expression Error (module main, line 1)

Explanation:

expression:statement is a conditional. The interpreter doesn't even syntax check the stuff to the right of the colon (if it did, we'd get a different error message) unless the stuff on the left evaluates to a nonzero value. However, as "Error" is an illegal expression, the interpreter can't evaluate it, exiting the program with this error message.

In some earlier interpreter versions, this would work instead:

Exception in thread "main" java.lang.RuntimeException: Could not evaluate expression Exception in thread "main" java.lang.RuntimeException (module main,line 1)
    at Loader.expr(Loader.java:183)
    at Loader.load(Loader.java:201)
    at Loader.main(Loader.java:249)

Pip, 71 bytes

code and error:

R is not a unary operator
Fatal error while parsing, execution aborted.

also:

Hit end of tokens while parsing expression
Fatal error while parsing, execution aborted.

Try it online!

33

Very simple. : isn't a valid command, so it's easy to make an unrecognised token error quine. The error is just where the : is in the code.

33 (1:8): Unrecognised token

W.Y.A.L.H.E.I.N., 253 bytes

Traceback (most recent call last):
  File "/opt/wyalhein/whenyouaccidentallylose100endorsementsinnationstates.py", line 6, in <module>
    seed = int(contents[0])
ValueError: invalid literal for int() with base 10: 'Traceback (most recent call last):\n'

Try it online!

whenyouaccidentallyloseahundredendorsementsinnationstates expects a seed on the first line, and Traceback (most recent call last): is not a valid number (unless we're talking in base 96, of course, but whenyouaccidentallyloseahundredendorsementsinnationstates doesn't).

Triangularity, 46 bytes

I smell no triangularity. YOU SHALL NOT PASS!

Try it online!

The language requires programs to be in the form of a triangle. If not, it denies you the gate to programming in the world of triangles. It will not let you pass.

Snowman, 121 bytes

SnowmanException thrown at tokenize
  what():  at tokenize: letter operator terminated prematurely?
fatal error, aborting

Try it online!

Ly

Error occurred at program index 3, instruction o (zero-indexed, includes comments)
EmptyStackError: cannot pop from an empty stack

Demo (using official compiler)

This program makes use of the o in "Error", the first instruction character in the error message that produces an error. (apparently r does nothing with an empty stack)

When a stack is not empty, o takes the top entry off the selected stack and outputs it as ASCII; EmptyStackError occurs when the selected stack is empty. So when Ly runs into this o, it causes this error, since we haven't given the stack anything yet.

ZSH (macOS), 20 bytes excluding newline

 zsh: bad pattern: ^[

ink, 65 bytes

ERROR: 'q' line 1: Empty diverts (->) are only valid on choices

Try it online!

Must be saved in a file called q, which is why the code on TIO is 7 bytes longer.

Turing Machine But Way Worse, 258 bytes

Traceback (most recent call last):
  File "/opt/tmbww/TuringMachineButWayWorse.py", line 16, in <module>
    i[0], i[2], i[3], i[5], i[6] =  int(i[0]), int(i[2]), int(i[3]), int(i[5]), int(i[6])
ValueError: invalid literal for int() with base 10: 'Traceback'

Try it online!

GHCi (a Haskell interpreter/shell)

Code.hs:1:1: Parse error: naked expression at top level

Usage:

Write the code in a file named Code and load with GHCi.

A nice fact is that, if the words were actual identifiers, this would be a legal expression (as long as it would typecheck). This is basically due to the fact that : is a built in operator, . is used for module-qualified names, and whitespace is used to denote function application.

Rust, 323 166 164 bytes

Call your program a. and use rustc a..

error: unknown start of token: \
 --> a.:1:32
  |
1 | error: unknown start of token: \
  |                                ^

error: aborting due to previous error

MiLambda

ERROR_NOHALT

Try it online!

Seems like a short solution

Javascript (Chrome/V8), 65 41 39 Bytes

Uncaught =u=_=>{throw`=u=${u};u()`};u()

Try it online!

K (ngn/k), 2 bytes

'c

Try it online!

'c is the response from the console indicating that the variable c is undefined

VB.Net, 32 Bytes

Create a new, empty project named 'A'. Set the startup object to "Sub Main" (it's a drop-down option). Create a new class called anything. Delete everything from the class and copy/paste the following:

'Sub Main' was not found in 'A'.

This works because a single quote is a comment, so it looks like a blank file :D

Malbolge, 32 bytes

invalid character in source file

Try it online!

Python 3, 28 bytes

SyntaxError: invalid syntax

Windows .EXE, 248 bytes

The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

No, really. Save as quine.txt, then rename to quine.exe (or download it here):

Cubically, 94 bytes


Notepad: 0

   000
   000
   000
111222333444
111222333444
111222333444
   555
   555
   555

There are newlines at the start and end. (Cubically automatically dumps its memory to STDERR when the program finishes.)

Try it online!

C

I applied the method of repeatedly copying the error messages to the source. It converged in 2 cycles. Compiled on OSX 10.9 with 'cc -c error.c'.

error.c:1:1: error: unknown type name 'error'
error.c:1:1: error: unknown type name 'error'
^
error.c:1:6: error: expected identifier or '('
error.c:1:1: error: unknown type name 'error'
     ^
2 errors generated.

Note: This is not so much an answer as it is a methodology to get one. The result might change depending on your OS or the version of cc you are using.

The exact method to get the result is to execute the instructions

$ cc -c error.c 2>out ; mv out error.c ; cat error.c

repeatedly until the output stops changing.

INTERCALL, 90 bytes

Fatal error: A INTERCALL program must start with the mandatory header to prevent golfing.\n

Includes a trailing newline at the end. Note that this isn't STDERR, but it was considered to be error output by many, so I posted it here.

This is the "mandatory header":

INTERCALL IS A ANTIGOLFING LANGUAGE
SO THIS HEADER IS HERE TO PREVENT GOLFING IN INTERCALL
THE PROGRAM STARTS HERE:

C (gcc)

error.c:1:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 error.c:1:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
      ^
compilation terminated due to -Wfatal-errors.

Compile with gcc -Wfatal-errors error.c.

Python 3

  File ".py", line 1
    File ".py", line 1
    ^
IndentationError: unexpected indent

x86 assembly

Bytecode:

53 65 67 6d 65 6e 74 61 75 69 6f 6e 20 66 61 75
6c 74 20 28 63 6f 72 65 20 64 75 6d 70 65 64 29

i.e. the text

Segmentation fault (core dumped)

Crashes immediately because the second instruction (the first being just "push %[er]bx") is

insl (%dx), %gs:(%di)

which fails because (a) ins cannot take segment overrides, (b) %dx and %di are almost certainly uninitialized, (c) %di is a 16-bit memory address and therefore can't be accessed in long mode, (d) ins is an invalid instruction outside of real mode.

The exact output may vary depending on what system this is run on, but it is likely that it will contain some form of illegal instruction.

NASM for x86: 45 bytes

e.asm:1: error: parser: instruction expected

Assemble (or attempt to assemble) with nasm e.asm

Just in case:

0:beau@beau-Latitude-E6330:[~/asm/q]$ nasm -v
NASM version 2.12.02 compiled on Feb  5 2017
0:beau@beau-Latitude-E6330:[~/asm/q]$ 

Recursiva, 7 bytes

Error!

Try it online!

k, oK

Might as well group these answers together, since it's supposedly the same language. I must say, this general approach is quite versatile.

oK

Every error seems to have a lot of environment-specific information, because, well, JavaScript is behind it all. Try it online!

/opt/ok/oK.js:876
    throw new Error("unexpected character '"+text[0]+"'");
    ^

Error: unexpected character ')'
    at Object.parse (/opt/ok/oK.js:876:8)
    at Object.<anonymous> (/opt/ok/repl.js:62:43)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)

k

Notice the space at the bottom. This works in 2016.06.28 (c) arthur whitney version of kmac.

a
^
value error
 

Example of it working.

sed

By using this general approach, I have converged on several sed error quines. This may not work in your sed, in which case, you're using the wrong sed, and therefore would you please acquire necessary, error-quining sed.

Try it online! This version works in TIO, and probably not anywhere else. Open the "Debug" panel to see the error.

<code>sed: 1: test.sed: bad flag in substitute command: 'd'</code> and <code>gsed: file toast.sed line 1: extra characters after command</code>

Where sed is macOS's default sed, and gsed is a GNU sed.

KSH script, 48 bytes

Save as a file named k.

k[1]: not: not found [No such file or directory]

Try it online! Note that TIO saves KSH scripts as .code.tio, so it's a bit longer but still the same thing.

Syms, 202 bytes

Traceback (most recent call last):
  File "/opt/syms/syms.py", line 196, in <module>
    stack.append(("{"+str(stack.pop())+"}").replace("\\","\\\\").replace("&","\\&"))
IndexError: pop from empty list

Try it online! Works on TIO. May not work on your configuration.

(t)csh

Unmatched '.

The trailing newline is needed to produce an exact match. Run it with csh quine.csh (or just type it into the shell, that works too).

GNU Make 4.1

make: *** No rule to make target 'No', needed by 'make'.  Stop.

This is syntactically valid:

GW-BASIC (least: 12 bytes)

Syntax error

Inspired by the Commodore 64 BASIC answer. Knocked off 2 bytes because IBM and DOS are better than Commodore :P You can download an emulator for GW-BASIC.

NEXT without FOR

Since GW-BASIC is a line-based language, it only evaluates the first instruction after a newline or colon :. Therefore, it reads NEXT and automatically fails it didn't read a FOR.

Apple ][ BASIC (13 bytes)

?SYNTAX ERROR

Woo, 1 less byte than the Commodore answer because the old Apples could beat a Commodore anyday :P

QBasic (43 bytes)

Parse failed: Syntax error at 1:1: Token(:)

Might be cheating because it only works on the first line.

Applesoft BASIC (69 bytes)

ParseError: Syntax error: Expected line number or separator in line 0

Also only works on the first line...

MATLAB, 66 bytes

Undefined function 'Undefined' for input arguments of type 'char'.

This outputs the same to STDERR (shown in the console in red):

enter image description here

This is actually pretty unknown functionality (and it's rarely useful), which is why the MATLAB submission in the "Hello World!"-challenge may be improved.

This works because MATLAB will automatically interpret a command on the form <word_1 word_2 word_3 word_4>, with no surrounding brackets, as a function on the form:

word_1('word_2')`

That is, it calls a function word_1 and gives the single input argument after the first, and in front of the second space as a string input to that function.

"Real life"-examples that can be used for golfing:

disp Hello   % Shorter than disp('Hello')
Hello

disp Hello World!
Hello

nnz variable
ans =
     8

Note that it will always interpret it as a string, it will not evaluate it:

variable = 3;
nnz variable
ans =
     8
nnz(variable)
ans =
     1

Python 3.5

Note: the source file should be named "1" for this to work

  File "1", line 1
    File "1", line 1
    ^
IndentationError: unexpected indent

ForceLang

Works in the latest version of the reference implementation as of the time this answer was written.

Exception in thread "main" lang.exceptions.IllegalInvocationException: Exception is not a function.
    at lang.ForceLang.parse(ForceLang.java:52)
    at lang.ForceLang.main(ForceLang.java:129)

Pyth

    s_push: parser stack overflow
Traceback (most recent call last):
  File "pyth.py", line 752, in <module>
    exec(code_to_remove_tools + py_code_line, environment)
MemoryError

Try it online!

SmileBASIC

NEXT without FOR in 0:1

Whenever the pre-run parser encounters a NEXT which isn't paired with a FOR, it produces the error NEXT without FOR in slot:line. Here, the code is in slot 0 and on line 1.

Processing IDE

Probably the friendliest error message I've ever seen.

Syntax error, maybe a missing semicolon?

Result

doodoood

Technically this is cheating a bit because the pane below it prints expected SEMI, found 'error'. Unfortunately the word error is written in single quotes, so trying to copy that into the source of the program causes it to spit out a massive "Badly formed character constant" error... which does not include any singly-quoted words allowing for it to quine itself.

ArnoldC, 28 bytes

WHAT THE FUCK DID I DO WRONG

This is the only error message in ArnoldC, though you do have to turn off stack traces.

TrumpScript - Making PPCG Great Again (TrumpScript)

When trying to run this language on a windows PC, the output is always:

Make sure the currently-running OS is not Windows, because we're not PC

So when running this program:

Make sure the currently-running OS is not Windows, because we're not PC

It won't even parse it because the OS check fails, and you get the error message. Examples can be given for Mac as well if anyone wants them haha. God I've wanted to use this in PPCG for awhile now, good that I finally get to.

Full list of errors that can be triggered using environmental specifics:
https://github.com/samshadwell/TrumpScript/blob/master/src/trumpscript/utils.py


Bonus Answer: ArnoldC (ArnoldC)

ArnoldC requires root declaration of IT'S SHOWTIME, meaning main(), so:

WHAT THE FUCK DID I DO WRONG

Results in the only error message in ArnoldC...

WHAT THE FUCK DID I DO WRONG

Which, is actually... hilarious. You have to run it non-verbose though w/o stack traces.

Ada

test.adb:1:01: compilation unit expected

Really just make an ada file, toss it at the start as above and compile with gcc filename.adb -c.

Codelike, 36 Bytes

Error at (1,1): Unknown character: E

Try it!

Mathematica

Syntax: "needed." is incomplete; more input is needed.

A . in Mathematica means either a decimal point or function Dot. In this case, the . appears at the end of an expression and cannot be interpreted.


enter image description here

Microsoft Excel

Formula: #DIV/0!

Error Message: #DIV/0!

In order to enter a formula without using an equals sign, go into Excel Options/Advanced/Lotus Compatibility Settings and enable Transition Formula Entry.

JavaScript

Uncaught SyntaxError: Unexpected identifier

Throws a generic Unexpected identifier error (in Chrome, at least) because it doesn't recognize Uncaught as an identifier.

F#

e.fs(1,11): error FS0010: Unexpected symbol ':' in implementation file

Compile with fsc --nologo e.fs. Again, there's an extra blank line I can't properly reproduce here. (Without the --nologo flag the compiler wants to announce itself and its version number and display a Microsoft copyright message.)

Elixir

== Compilation error on file e.ex ==
** (SyntaxError) e.ex:3: keyword argument must be followed by space after: ex:
    (elixir) lib/kernel/parallel_compiler.ex:114: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

Put the code in e.ex and compile with elixirc e.ex. There are also some blank lines in the output (and in the file), but I can't get them to appear on here; S.O. eats them.

Bash

$ bash: bash:: command not found
bash: bash:: command not found

Straw

/opt/straw/straw.rb:108:in `initialize': no implicit conversion of nil into String (TypeError)
    from /opt/straw/straw.rb:108:in `new'
    from /opt/straw/straw.rb:108:in `step'
    from /opt/straw/straw.rb:225:in `run'
    from /opt/straw/straw.rb:254:in `<main>'

Try It Online!

BBC Basic, 7 bytes (or 0 Bytes)

This is a valid 7 byte entry:

Mistake

This is the error message produced by the interpreter when it is completely unable to make sense of the code.

On the other hand, this is not:

ERROR

This is a valid keyword in BBC Basic which is supposed to deliberately introduce an error of a specified code into the program, but the syntax is wrong (no code is given.) Therefore it returns Syntax error (which in turn returns Mistake when it is run.)

In general the procedure described by Falko in his answer leads to Mistake in BBC basic. There are a few exceptions. anything producing the errorsDATA not LOCAL or ON ERROR not LOCAL leads to the famous zero byte quine: an empty source code produces an empty file.

Given that most error messages in BBC basic are lowercase (and therefore not valid keywords) I am pretty sure that any invalid input will ultimately lead to one of these possibilities.

Factor

No word named "No" found in current vocabulary search path

Guess what it prints?

No word named "No" found in current vocabulary search path

CJam, 12 bytes

u not handled

When operator doesn't exist, interpreter prints * not handled

AppleScript

A identifier can’t go after this identifier.

Both A and identifier can be identifiers, so AppleScript says no.

identifiers

C++ (g++)

The file must be saved as 1.pas.

g++: error: 1.pas: Pascal compiler not installed on this system

Commodore 64 Basic

?SYNTAX  ERROR

When run on the emulator of your choice (or an actual Commodore 64), produces

?SYNTAX  ERROR

This is, in fact, a syntactically-valid one-line program. The question mark is a shortcut for PRINT, and SYNTAX and ERROR are valid variable names. The error occurs because the parser gets confused by the substring OR in ERROR.

ArnoldC

missing IT'S SHOWTIME on first line

Paste the code into this compiler.

CJam

Syntax error:
java.lang.RuntimeException: y not handled

zsh (Linux)

zsh: command not found: zsh:

Should work with some small changes in just about any other shell.

><> - 25 Bytes

something smells fishy...

In Fish, any bad instruction outputs the error: "something smells fishy...". Since s is not a valid command, it errors immediately.

ChucK

Here's my contribution:

[chuck]:line(1).char(8): syntax error

This works if you first type it into the editor, save it as "chuck", and then run it once. If you run it another time the number in char() goes up by eight.

ChucK can be downloaded here.

Applescript (in Script Editor)

Syntax Error
A "error" can't go after this identifier.

enter image description here

Java, in Eclipse

Syntax error on tokens, delete these tokens

Forth

Try it here

This was surprisingly easy to come up with.

a : error(-13): word not found

C++

(Using Apple LLVM in Xcode)

Unknown type name 'Unknown'
Expected ';' after top level declarator

Perl

syntax error at quine.pl line 2, at EOF
Execution of quine.pl aborted due to compilation errors.

Replace quine.pl with whatever you named the file and enjoy.

CJam 0.6.2

Syntax error:
java.lang.RuntimeException: y not handled

Try it online.

R (GUI)

Error: unexpected symbol in "Error: unexpected symbol"

The issue here is replicating the ", which causes the error message to change from unexpected symbol to unexpected string constant. Pretty much any error R throws will have the form Error: <something> in "<bad code>", so you will pretty much always have to contend with the quoting. I tried this several other ways and always ended up falling back here.

Ed (1 byte)

All the other solutions thus far are long and ugly. I suppose that is because of the nature of most error messages. But a good error message is elegant in its simplicity. For that, look no further than ed.

?

Save this to a file called edscript and run with ed < edscript, or run ed<<<?. The result:

?

The question mark is written to stderr and ed returns 1, so this actually is an error message. I wonder why ed isn't very popular?

False (0 bytes)

Run with false filename. It writes the program's source code (i.e. nothing) to stderr and returns 1. Of course, calling false a programming language is questionable, and the zero byte quine is unoriginal, but I thought I might as well add it. There is probably some interpreter for a language that prints no error messages, and could replace false.

Now I wish this was code golf.

Rebol

Interestingly, the error message here parses as symbols/tokens:

x
** Script error: x has no value
** Where: do either either either -apply-
** Near: do intern code

So despite looking error-like, it could be made a valid Rebol program if you gave all the words meanings.

However if you wanted an error at the parse phase vs. a runtime error in the code, the program/error could be:

1A
** Syntax error: invalid "integer" -- "1A"
** Where: to case load either either -apply-
** Near: (line 1) 1A

So given that distinction is possible, you can do fun things if you redefine ** from exponentiation into something else (which I can't think of how to make useful for this particular challenge, given it's a quine.)

(Note: Trying to abuse it for a trick uncovered a peculiarity of what happens when ** (an infix operator) is redefined and then used immediately after. I tried:

**: function [:a :b :c :d :e :f] []
** Syntax error: invalid "integer" -- "1A"
** Where: to case load either either -apply-
** Near: (line 1) 1A

My goal was to override the ** so that it would accept its arguments unevaluated. That way ** Syntax error: invalid "integer" -- "1A" (or whatever) would not attempt to assign invalid to error, but pass the symbols to **. But because ** is infix it attempted to raise the function body to the power of Syntax prior to the completion of the assignment of **:.

It can be remedied by putting any token between the [] and the **. But it helps to remember how your language evaluator works. :-P)

ksh

$ ksh: ksh::  not found.
ksh: ksh::  not found.

Java 8 compilation error quine (12203 bytes)

Generated on windows + mingw with java 1.8.0_11 jdk, using this command:

echo a > Q.java; while true; do javac Q.java 2> Q.err; if [ $(diff Q.err Q.java | wc -c) -eq 0 ]; then break; fi; cat Q.err > Q.java; done

May not be the shortest one, may not be the longest one either, more a proof of concept. Works because error output shows at most 100 errors.

Q.java:1: error: class, interface, or enum expected
Q.java:1: error: class, interface, or enum expected
^
Q.java:1: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                      ^
Q.java:1: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                                 ^
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
Q.java:1: error: class, interface, or enum expected
                                      ^
  (use -source 1.4 or lower to use 'enum' as an identifier)
Q.java:1: error: = expected
Q.java:1: error: class, interface, or enum expected
                                           ^
Q.java:2: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
      ^
Q.java:2: error: ';' expected
Q.java:1: error: class, interface, or enum expected
       ^
Q.java:2: error: illegal start of type
Q.java:1: error: class, interface, or enum expected
        ^
Q.java:2: error: = expected
Q.java:1: error: class, interface, or enum expected
               ^
Q.java:2: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                      ^
Q.java:2: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                                 ^
Q.java:2: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
Q.java:1: error: class, interface, or enum expected
                                      ^
  (use -source 1.4 or lower to use 'enum' as an identifier)
Q.java:2: error: = expected
Q.java:1: error: class, interface, or enum expected
                                           ^
Q.java:3: error: illegal start of type
^
^
Q.java:4: error: = expected
Q.java:1: error: <identifier> expected
 ^
Q.java:4: error: <identifier> expected
Q.java:1: error: <identifier> expected
      ^
Q.java:4: error: ';' expected
Q.java:1: error: <identifier> expected
       ^
Q.java:4: error: illegal start of type
Q.java:1: error: <identifier> expected
        ^
Q.java:4: error: = expected
Q.java:1: error: <identifier> expected
               ^
Q.java:5: error: '(' expected
Q.java:1: error: class, interface, or enum expected
 ^
Q.java:5: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
      ^
Q.java:5: error: ';' expected
Q.java:1: error: class, interface, or enum expected
       ^
Q.java:5: error: illegal start of type
Q.java:1: error: class, interface, or enum expected
        ^
Q.java:5: error: = expected
Q.java:1: error: class, interface, or enum expected
               ^
Q.java:5: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                      ^
Q.java:5: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                                 ^
Q.java:5: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
Q.java:1: error: class, interface, or enum expected
                                      ^
  (use -source 1.4 or lower to use 'enum' as an identifier)
Q.java:5: error: = expected
Q.java:1: error: class, interface, or enum expected
                                           ^
Q.java:6: error: illegal start of type
                      ^
                      ^
Q.java:7: error: = expected
Q.java:1: error: <identifier> expected
 ^
Q.java:7: error: <identifier> expected
Q.java:1: error: <identifier> expected
      ^
Q.java:7: error: ';' expected
Q.java:1: error: <identifier> expected
       ^
Q.java:7: error: illegal start of type
Q.java:1: error: <identifier> expected
        ^
Q.java:7: error: = expected
Q.java:1: error: <identifier> expected
               ^
Q.java:8: error: '(' expected
Q.java:1: error: class, interface, or enum expected
 ^
Q.java:8: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
      ^
Q.java:8: error: ';' expected
Q.java:1: error: class, interface, or enum expected
       ^
Q.java:8: error: illegal start of type
Q.java:1: error: class, interface, or enum expected
        ^
Q.java:8: error: = expected
Q.java:1: error: class, interface, or enum expected
               ^
Q.java:8: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                      ^
Q.java:8: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                                 ^
Q.java:8: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
Q.java:1: error: class, interface, or enum expected
                                      ^
  (use -source 1.4 or lower to use 'enum' as an identifier)
Q.java:8: error: = expected
Q.java:1: error: class, interface, or enum expected
                                           ^
Q.java:9: error: illegal start of type
                                 ^
                                 ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
 ^
Q.java:10: error: <identifier> expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
      ^
Q.java:10: error: ';' expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
       ^
Q.java:10: error: illegal start of type
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
        ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
               ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                       ^
Q.java:10: error: illegal start of type
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                               ^
Q.java:10: error: <identifier> expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                ^
Q.java:10: error: unclosed character literal
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                  ^
Q.java:10: error: ';' expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                    ^
Q.java:10: error: unclosed character literal
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                       ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                                     ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                                           ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                                                      ^
Q.java:10: error: = expected
Q.java:1: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
                                                                                 ^
Q.java:11: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
      ^
Q.java:11: error: ';' expected
Q.java:1: error: class, interface, or enum expected
       ^
Q.java:11: error: illegal start of type
Q.java:1: error: class, interface, or enum expected
        ^
Q.java:11: error: = expected
Q.java:1: error: class, interface, or enum expected
               ^
Q.java:11: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                      ^
Q.java:11: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                                 ^
Q.java:11: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
Q.java:1: error: class, interface, or enum expected
                                      ^
  (use -source 1.4 or lower to use 'enum' as an identifier)
Q.java:11: error: = expected
Q.java:1: error: class, interface, or enum expected
                                           ^
Q.java:12: error: illegal start of type
                                      ^
                                      ^
Q.java:12: error: <identifier> expected
                                      ^
                                       ^
Q.java:13: error: = expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
   ^
Q.java:13: error: ';' expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
      ^
Q.java:13: error: <identifier> expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
              ^
Q.java:13: error: = expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
               ^
Q.java:13: error: ';' expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
                  ^
Q.java:13: error: = expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
                               ^
Q.java:13: error: unclosed character literal
  (use -source 1.4 or lower to use 'enum' as an identifier)
                                   ^
Q.java:13: error: unclosed character literal
  (use -source 1.4 or lower to use 'enum' as an identifier)
                                        ^
Q.java:13: error: = expected
  (use -source 1.4 or lower to use 'enum' as an identifier)
                                                          ^
Q.java:14: error: <identifier> expected
Q.java:1: error: = expected
      ^
Q.java:14: error: ';' expected
Q.java:1: error: = expected
       ^
Q.java:14: error: illegal start of type
Q.java:1: error: = expected
        ^
Q.java:14: error: = expected
Q.java:1: error: = expected
               ^
Q.java:14: error: illegal start of type
Q.java:1: error: = expected
                 ^
Q.java:15: error: = expected
Q.java:1: error: class, interface, or enum expected
^
Q.java:15: error: illegal start of type
Q.java:1: error: class, interface, or enum expected
 ^
Q.java:15: error: = expected
Q.java:1: error: class, interface, or enum expected
      ^
Q.java:15: error: illegal start of type
Q.java:1: error: class, interface, or enum expected
       ^
Q.java:15: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
        ^
Q.java:15: error: = expected
Q.java:1: error: class, interface, or enum expected
          ^
Q.java:15: error: ';' expected
Q.java:1: error: class, interface, or enum expected
               ^
Q.java:15: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                      ^
Q.java:15: error: <identifier> expected
Q.java:1: error: class, interface, or enum expected
                                 ^
Q.java:15: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
Q.java:1: error: class, interface, or enum expected
                                      ^
  (use -source 1.4 or lower to use 'enum' as an identifier)
Q.java:15: error: = expected
Q.java:1: error: class, interface, or enum expected
                                           ^
Q.java:16: error: illegal start of type
                                           ^
                                           ^
Q.java:17: error: = expected
Q.java:2: error: <identifier> expected
 ^
Q.java:17: error: <identifier> expected
Q.java:2: error: <identifier> expected
      ^
Q.java:17: error: ';' expected
Q.java:2: error: <identifier> expected
       ^
Q.java:17: error: illegal start of type
Q.java:2: error: <identifier> expected
        ^
Q.java:17: error: = expected
Q.java:2: error: <identifier> expected
               ^
100 errors

Befunge on Wasabi v1.4

There is an interpreter for Befunge called Wasabi, and when an error appears the error message is in the format of a dialog box. This is the program:

Unsupported Command : 'U' at (1, 0). Ignore next syntax error(s)?

To test, download Wasabi v1.4 and insert the above program.

Cobra

test.cobra(1): error: Expecting use, assembly, namespace, class, interface or enum, but got "test".
Compilation failed - 1 error, 0 warnings
Not running due to errors above.

Windows Command Prompt

& was unexpected at this time.

enter image description here

Lua (console), 35 bytes

This is what you get in the Lua console with the usual iterative approach:

stdin:1: '<name>' expected near '1'

which is a bit shorter than the one obtained for putting the code in a file.

Whitespace

First I thought this is clearly impossible. But actually it is trivial as well. -.-

Fail: Input.hs:108: Non-exhaustive patterns in function parseNum'

Try it.

Yeah, my first whitespace program! ;)

CoffeeScript, syntactically valid

As tested on their website using Chrome or Firefox.

ReferenceError: defined is not defined

You can replace defined with anything that's not a built-in variable, but I thought this version was fun. Unfortunately, undefined is not defined in particular doesn't work as a quine.

In CoffeeScript this isn't even a syntax error, because it compiles. This is technically a runtime error in JavaScript, albeit a boring one. CoffeeScript is a likely candidate to produce some more interesting runtime error quines because a lot of funny sentences are valid code. E.g. the above example compiles to

({
  ReferenceError: defined === !defined
});

Bash (32)

Save as file named x:

x: line 1: x:: command not found

When run:

>> bash x
x: line 1: x:: command not found

Go

Another fairly easy one using the "general approach" provided in the other answer. I still like my JavaScript ones better.

can't load package: package : 
prog.go:1:1: expected 'package', found 'IDENT' can
prog.go:2:2: invalid package name _

Try it.

Python

Spyder

Well, a rather trivial solution for the Spyder IDE is to raise a SyntaxError.

Code and identical output:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 540, in runfile
    execfile(filename, namespace)
  File "/Users/falko/golf.py", line 1
    Traceback (most recent call last):
                         ^
SyntaxError: invalid syntax

(Python 2.7.8 with Spyder 2.2.5)


Terminal

An alternative solution for Python started from command line struggles with an unexpected indent.

Command:

python golf.py

Code and identical output:

  File "golf.py", line 1
    File "golf.py", line 1
    ^
IndentationError: unexpected indent

ideone.com

On ideone.com a solution might be as follows. (Try it!)

Code and identical output:

Traceback (most recent call last):

  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/py_compile.py", line 117, in compile
    raise py_exc
py_compile.PyCompileError: SyntaxError: ('invalid syntax', ('prog.py', 1, 22, 'Traceback (most recent call last):\n'))

(This is for Python 2. An example for Python 3 is trivial but with 15 lines of "code" rather lengthy.)


General approach:

How to create your own solution in 2 minutes?

  1. Open a new file in an IDE of your choice.
  2. Bang your head onto the keyboard in front of you.
  3. Compile.
  4. Replace the code with the compiler error message.
  5. Repeat steps 3 and 4 until the code converges.

I bet such a procedure terminates pretty quickly in most cases!

CoffeeScript

Fails on first error, so it's fairly easy to do:

E:\foo.coffee:1:3: error: unexpected \
E:\foo.coffee:1:3: error: unexpected \
  ^

Demo

E:\>coffee -c foo.coffee
E:\foo.coffee:1:3: error: unexpected \
E:\foo.coffee:1:3: error: unexpected \
  ^

E:\>

Julia 0.2.0

Another syntax error found iteratively until a fixed point was reached:

ERROR: syntax: extra token "token" after end of expression

Lua

Code:

lua: ERROR.lua:1: function arguments expected near '.'

It seems fairly easy to do with lua. I also modified it to work on ideone.com as:

luac: prog.lua:1: function arguments expected near '.'

Try it.

JavaScript

Since different browsers use different JavaScript compilers, they produce different messages. These are, however, rather trivial solutions.

V8 (Chrome 36 / Node.js)

SyntaxError: Unexpected identifier

enter image description here

SpiderMonkey (Firefox 31)

SyntaxError: missing ; before statement

enter image description here

Chakra (Internet Explorer 11)

Expected ';'

enter image description here

Ruby 2 on Windows

Code:

error.rb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
error.rb:1: syntax error, unexpected tI...
          ^

The code was found by testing and iterating the process over and over until a fix-point was reached. The code must be inside the file "error.rb".

Demo:

C:\>type error.rb
error.rb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTR
ING_DBEG or tSTRING_DVAR or tSTRING_END
error.rb:1: syntax error, unexpected tI...
          ^

C:\>ruby.exe error.rb
error.rb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTR
ING_DBEG or tSTRING_DVAR or tSTRING_END
error.rb:1: syntax error, unexpected tI...
          ^