3
\$\begingroup\$

The goal is to raise the error message with the most bytes! The error message may not be generated by the program itself, such as Python's raise. errors that do not terminate the program are not allowed unless they do not show an error message.

Here is an example in python that raises 243041 bytes of error code:

def a(m):
    try:-''
    except:
        if m>0:
            a(m-1)
        else:-''
a(900)

you can try it here.

\$\endgroup\$
14
  • 2
    \$\begingroup\$ That's not true for all languages; many languages will continue execution after an exception is thrown \$\endgroup\$ Jan 21 at 19:28
  • 4
    \$\begingroup\$ This feels less like a code challenge and more like a challenge to find the language with the most verbose error messages. \$\endgroup\$
    – Shaggy
    Jan 21 at 19:44
  • 3
    \$\begingroup\$ So, maybe I'm missing something about Python, but doesn't your example utilize errors that do not terminate the code execution, seeing as they are trapped in a try block? If that's so, is it allowed to utilize errors that do not terminate code execution, so long as the code does eventually terminate; or is the example rendered invalid by this clarification? \$\endgroup\$ Jan 21 at 19:48
  • 3
    \$\begingroup\$ I think this is a duplicate of really any challenge involving printing big numbers e.g. this or this, as answers aren't going to do anything other than "generate big number, repeat string that many times, execute" as having a long string is usually an error. I'd VTC as a duplicate of one of them if I hadn't already VTCed as unclear, but even if this is clarified and reopened, I still believe it should stay closed \$\endgroup\$ Jan 21 at 20:20
  • 1
    \$\begingroup\$ @user In it's current state, I stand by my VTC as unclear, as the challenge needs a proper description of an "error", but challenges don't need to be exact duplicates to be closed as one another \$\endgroup\$ Jan 21 at 20:47
4
\$\begingroup\$

Python 3, \$\approx\$A(A(A(9,9),A(9,9)),A(A(9,9),A(99,99))) where A is the Ackermann function,or limited by RAM

A=lambda m,n:m and A(m-1,n<1or A(m,n-1))or-~n
a='.'*(A(A(A(9,9),A(9,9)),A(A(9,9),A(99,99))))
exec(a)

Don't try it online!

Stole the Ackermann function from here.

More manageable version to demonstrate:

A=lambda m,n:m and A(m-1,n<1or A(m,n-1))or-~n
a='.'*(9999)
exec(a)

Try it online!

Admittedly I'm not certain this approach is arbitrarily extendible in practice.

\$\endgroup\$
2
  • \$\begingroup\$ I think you can squeeze in a few more 9s, or one more A(), by moving the second line into the exec and eliminating a=. But either way it seems that the recursion limit needs to be increased (massively) to produce the intended error. I gather that this can be done (in principle) via sys.setrecursionlimit, but I'm not sure whether there's a policy on counting the bytes required to do this. \$\endgroup\$
    – Dingus
    Jan 21 at 22:40
  • 2
    \$\begingroup\$ @Dingus I haven't done the math, but I am going to confidently say that no computer that is even theoretically capable of existing in our universe could handle the amount of recursion necessary to execute this answer. \$\endgroup\$
    – mypetlion
    Apr 21 at 22:49
3
\$\begingroup\$

Jelly, a huge number \$ + 1605\$ bytes

ȷ!!!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡!¡”.xŒV

Try it online!

More specifically, this outputs an error message which is 1605 bytes long, plus two occurrences of massive chains of .... Unsurprisingly, this does not actually show an error really no matter where you run it, but in theory it will

I'm not entirely sure just how large this number is, aside from being significantly larger than \$1000!_{1000!_{(1000!)!}}\$, where \$n!_k\$ represents applying \$!\$ to \$n\$ \$k\$ times e.g. \$3!_3 = ((3!)!)! = (6!)! = 720! = 2.6 \times 10^{1746}\$

\$\endgroup\$
2
\$\begingroup\$

APL (Dyalog Unicode), limited only by available memory

Full program. Causes error message a bit bigger than twice the given number.

⍎2e6⍴⎕A

Try it online!

⎕A the uppercase Alphabet

2e6⍴ cyclically reshape to a string with two million characters

 execute

This causes an error of the form:

VALUE ERROR: Undefined name: string
      string
\$\endgroup\$
9
  • \$\begingroup\$ if you theoretically had an infinite memory, how long would the error be? \$\endgroup\$
    – someone
    Jan 21 at 19:55
  • \$\begingroup\$ @someone Simply increase the number (2e6 in the post) until the memory fills. \$\endgroup\$
    – Adám
    Jan 21 at 19:57
  • \$\begingroup\$ if you increased the number enough, it would be bigger that one hundred bytes, which is the maximum allowed size, so you can't enlarge the number forever. \$\endgroup\$
    – someone
    Jan 21 at 20:00
  • \$\begingroup\$ @someone The universe is estimated to be able to contain about 10¹²² bits, i.e. about 10¹²² bytes, so since we're using exponential format, 1e6 would simple need to be replaced by the 2 bytes longer 1e122, possibly adding a few bytes for more significant digits, once the exact number is known. \$\endgroup\$
    – Adám
    Jan 21 at 20:05
  • \$\begingroup\$ Given the limit is 100 bytes, surely something like ⍎9e999...99⍴⎕A with enough 9s to get to 100 bytes would be the best score? \$\endgroup\$ Jan 21 at 20:06
0
\$\begingroup\$

Java 11, repeat error message [231 - 1] times

String's Maximum length in Java is Integer.MAX_VALUE i.e. == 231 - 1, or less, it depends on server max memory size and other conditions otherwise it produces OutOfMemoryError.

  1. You can throw some Error with the certain message, for example:

    throw new Error("fatal".repeat(Integer.MAX_VALUE/5));
    

    Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

  2. You can return something like this. It is not the error itself, but the error message:

    for(int i=0;i<Integer.MAX_VALUE;i++){
        String m="fatal"+i;
        out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
    }
    
\$\endgroup\$
0
0
\$\begingroup\$

Zsh, \$4\times(9\times10^{307})^{32}+47\$ bytes

alias r=repeat\ 9e307
r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r a+=1111
let $a

Try it online!

Generates a string containing \$4\times(9\times10^{307})^{32}\$ ones, then tries to evaluate it as an integer.

In practice you will obviously run into memory limitations. Here is a more manageable version:

repeat 9e1 repeat 9e1 a+=1
let $a
  • alias r=repeat\ 9e307 allows us to nest more repeats in the 100 bytes we have
  • 9e307 (\$9\times10^{307}\$) is the largest compact finite floating-point number zsh might be able to count to
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.