Vocabulary/ErrorMessages

From J Wiki
Jump to navigation Jump to search

Back to: Vocabulary

Error Messages

assertion failure Your assert. line did not produce (a list of all) 1 (true). (More...)
attention interrupt

break

You interrupted execution with the JBreak icon. (More...)
control error While loading script: bad use of if. else. end. etc. (More...)
domain error Invalid value: An argument or operand has an invalid value. (More...)
Invalid public assignment: You've used both (z=:) and (z=.) for some name z. (More...)
Pun in definitions: A name was referred to as one part of speech, but the definition was later changed to another part of speech. (More...)
file name error nonexistent device or file. (More...)
file number error no file open with that number. (More...)
fixed-precision overflow the result of an operation on fixed-size integers would not fit in that size. (More...)
fold limit your Fold did not terminate when you expected. (More...)
ill-formed name Invalid underscores in a name. (More...)
ill-formed number A word starting with a number is not a valid number. (More...)
index error accessing out of bounds of your array. (More...)
interface error illegal filename or request, or missing component. (More...)
length error x and y do not agree, or an argument has invalid length. (More...)
locale error You tried to use an expired locale. (More...)
limit error A size is too large, or an internal limit was exceeded (More...)
NaN error result is not a valid number. (More...)
no result Fold terminated without executing anything. (More...)
nonce error feature not supported yet. (More...)
non-unique sparse elements You attempted an operation on a sparse array that would have required expanding the array. (More...)
noun result was required Verbs, and test blocks within explicit definitions, must produce noun results. (More...)
open quote string started but not ended. (More...)
out of memory noun too big for computer. (More...)
rank error operand can't have that rank. (More...)
security violation J has attempted something insecure after you demanded heightened security. (More...)
spelling error You've . or : in the wrong place. (More...)
stack error During debugging: You tried to change the definition of a suspended entity. (More...)
Any time: Too many recursions took place. (More...)
syntax error Sentence has an unexecutable phrase. (More...)
time limit Execution took too long. (More...)
uncaught throw. There was no catcht. block to pick up your throw. (More...)
valence error The verb doesn't have a definition for the valence it was executed with. (More...)
value error that name has no value yet. (More...)
would deadlock Doing what you asked would lock up the system. (More...)

Form of an error message

Error messages are reported with lines beginning with | in column 1. Example:

   1 2 + 3 4 5
|length error, executing dyad +
|shapes 2 and 3 do not conform
|   1 2    +3 4 5

The format is:
| error_title[ in name][ (from pyx) ][, executing phrase]
|optional explanatory line
|optional line indicating mismatched parentheses
|your_sentence with extra spaces removed, and four spaces installed before the word(s) in error
|line number of error, for explicit definitions or files loaded with load/require

  • error_title, described below, indicates the type of error
  • name is the name of the entity that was executing at the point of failure
  • When you open a pyx that completed with error, the error is signaled again in the opening thread, with (from pyx) added to the error message
  • phrase is the lowest-level phrase that was executing. This is often a primitive, but could be a combination supported by special code

Pre-execution Errors

The first stage of executing a sentence is converting the characters to J words. Errors at this stage include

  • illegal inflections like +..., flagged as spelling errors
  • invalid words, like 1qs which starts with a numeric but is not a valid number, flagged as ill-formed numbers

and prevent execution of the sentence. These pre-execution errors display an extra line containing ^ pointing to the error but do not have extra spaces removed.

   1 + 2xx
|ill-formed number
|   1 + 2xx
|       ^

Errors Creating Explicit Definitions

When an explicit definition is created (by using {{ }} or by executing verb/adverb/conjunction define or 1/2/3 : 0), it is immediately preprocessed with some error checking for

  • pre-execution errors as described above
  • mismatched control statements, flagged as control errors

These errors display the subline on which the syntax check stopped. (A subline is either an entire line or part of a line starting with a control word and ending before the next control word or end-of-line.)

   a =: {{
b =. 1 + y
b =. 1 + y 5 do. b =. y
}}
|control error, defining explicit entity
|the line, with its number in its definition shown in brackets, has a mismatched control structure
|   [1]b =. 1 + y 5 do. b =. y
|   a=:{{b =. 1 + y...}}

Errors While Executing Explicit Definitions

When debugging is enabled, an error while running a sentence from an explicit definition is given an extra line to indicate the line number of the error:

   a =: {{
1
x + y
}}  NB. define a function
   1 a 'a'   NB. execute normally
|domain error in a, executing dyad +
|y is character
|   x    +y
   dbr 1   NB. enable debugging
   1 a 'a'   NB. execute with debugging enabled
|domain error in a, executing dyad +
|y is character
|   x    +y
|a[:1]

The error occurred in line 1 of the dyadic valence of a. (The first line is line 0; the : indicates dyadic valence)

Error Detected While Loading Scripts

When an error is detected while running a sentence from an explicit definition, an additional line is typed giving the line number of the error

   NB. Here is the script we will be loading:
NB. errors in scripts
NB.
a =: {{
+y
1 + 2xx
}}
b =: 2 + 3xx

   NB. Now load it:
   load 'a.ijs'
|ill-formed number: script
|   1 + 2xx
|       ^
|   a=:{{+y...}}
|[-6] c:\users\henry\j904-user\temp\1.ijs

The number at the end is the line number in the file at which the error was detected, here line number 6. (The first line is line 1). Line 6 is the end of the definition of a; you will have to look through the definition to find ill-formed number 2xx .

Mismatched Parentheses

Mismatched parentheses are an error in J, but they are not detected before execution. Instead, right-to-left execution starts immediately, and any mismatched parentheses are recognized as a syntax error at the end of the sentence.

A sentence with mismatched parentheses may fail for some other reason before the syntax error is recognized - and often the parenthesization error is responsible for the failure. For this reason, when a sentence fails and contains mismatched parentheses, both errors are reported at the same time. Each error is preceded by 4 spaces, with the error following the spaces, and the message indicates which error is a mismatched parenthesis.

   1 2 (2 1))} i. 5
|syntax error, unexecutable fragment (noun noun)
|to concatenate nouns use a verb such as ,
|unmatched ) to the right of the word in error
|       1 2(2 1)    )}i.5

It might be interesting to see why the parser called this an unexecutable fragment, but the real problem is the rightmost error, the unmatched parenthesis.

Disabling Error Formatting

Legacy code that depends on the old-fashioned terse form of messages can disable formatting by executing

   4!:55 <'eformat_j_'

Accessing the error status

Find the error number of the last error that J signalled by using Foreign (13!:11) and find the associated message by using Foreign (13!:12).

You can do this at any time, not only immediately after the error.

   badname_ =: 1   NB. raise a typical error
|ill-formed name: badname_

   13!:11''        NB. error number
4
   13!:12''        NB. associated error message
|ill-formed name: badname_

Foreign  9!:8 gives the list of all possible error messages

   9!:8''
+-------------------+-----+------------+---------------+-----------------+-----------+---------------+...
|attention interrupt|break|domain error|ill-formed name|ill-formed number|index error|interface error|...
+-------------------+-----+------------+---------------+-----------------+-----------+---------------+...

Select from this list to see which one applies to you, using Foreign (13!:11) and (9!:8)

Note: error number 1 corresponds to the first message in the list, i.e. item 0 .

   (<: 13!:11'') { 9!:8''
+---------------+
|ill-formed name|
+---------------+

You can use these facilities in  try./catch. blocks to analyze errors.

emsg =: verb define
esentence =. 4 }. > {: <;._2 (13!:12) ''
estring =. > (<: 13!:11 '') { 9!:8 ''
'Your lordship''s sentence, ',esentence,', while correct up to a point, may exhibit ',estring,'.'
)
exec =: verb define   NB. execute the sentence y
try.
  ". y
catch.
  smoutput emsg''
  i. 0 0
end.
exec '5 + a:'
Your lordship's sentence, 5    +a:, while correct up to a point, may exhibit domain error.

Defining your own error conditions

You can define your own error conditions by using 13!:8, with error numbers 0 to 255.

The following utility: errif examines the Boolean condition y and signals error number x (222 by default) if (y=1). It does nothing if (y=0).

Strictly speaking: errif returns (i.0 0) if (y=0).

   errif=: 222&$: :([: 13!:8 #~)

   errif 0
   errif 1
|: errif
   13!:11''   NB. show the last error number
222

Error numbers currently used by J itself are as follows:

 1 attention interrupt
 2 break
 3 domain error
 4 ill-formed name
 5 ill-formed number
 6 index error
 7 interface error
 8 input interrupt
 9 length error
10 limit error
11 nonce error
12 assertion failure
13 open quote
14 rank error
15 (internal use)
16 spelling error
17 stack error
18 stop
19 syntax error
20 system error
21 value error
22 out of memory
23 control error
24 file access error
25 file name error
26 file number error
27 time limit
28 security violation
29 non-unique sparse elements
30 locale error
31 read-only data
32 allocation error
33 NaN error
34 noun result was required
35 uncaught throw.
36 fold limit
37 valence error
38-43 (internal use)
44 would deadlock
45 (internal use)
46 fixed-precision overflow
47 (internal use)
48 no result

Explanations of individual error messages

Before looking up the error message, look at the typeout of the failing sentence to find the three spaces that precede the word whose execution failed. Many messages have different interpretations depending on what failed.


Warning.png assertion failure

The result of the sentence following an assert. control word contains an atom that is not 1.

Note: this is a more stringent requirement than for the T-block (T) in if. T do. which disregards all but the first atom of T .

Also, T-blocks can contain more than one sentence, while assert. allows only one.

If you see this error, it does not mean an "error" in the sense of the assert.-sentence itself being badly coded (which anyway would signal a different kind of J error). Rather it means the "failure" of the "assertion(s)" you have chosen to make is something that deserves to be reported as an "error".

This is one way to force an error without needing to invent a sentence that actually fails when it's executed.

Another is by using 13!:8 which allows you to choose the error number and text.

   matinv =: monad define
assert. 2 = #$y [ 'matinv rank error'   NB. (%. needs y to have rank 2)
%. y
)
   matinv 1 2 3
|assertion failure: matinv
|   2=#$y['matinv rank error'

It is good practice to put text on the  assert. line as shown, so you can see exactly which line failed.

Note in the above example that the  NB.-comment text was not echoed.


Warning.png attention interrupt

Warning.png break

J signals  attention interrupt or  break when you execute JBreak. But it's not a program-logic error because you've deliberately made it happen.

The  attention interrupt condition is raised at the next completion of a sentence of an explicit definition. If your program is stuck in a sentence that will take too long to complete, you can execute JBreak again, which will immediately raise the  break condition whenever your program executes a named entity or does anything that allocates memory. If your program is stuck in a single expression that does not allocate memory, you will have to wait for it to finish.


Warning.png control error (during load)

If  control error is detected when a script is being loaded, it's due to a bad control structure (if./do./end. etc.).

Typical mistakes:

1. Forgetting a component of a control structure such as  do. or  end.

2. Leaving off final period, e.g.  if 0=#y do

   foo=: verb define
if. 0=#y do. 'empty'
else. 1=#y do. 'one letter'
else. 'good:' ; y
end.
)
|control error
|   [1]else. 1=#y do. 'one letter'
|   foo=:    verb define
   foo=: verb define
if. 0=#y do. 'empty'
elseif. 1=#y do. 'one letter'
else. 'good:' ; y   NB. omitted condition always tests true
end.
)

Warning.png domain error (invalid value)

The verb isn't meant to handle one of more of its arguments. The error could be an invalid type or an invalid value.

Verbs convert precision as needed.

   2 + 'a'    NB. Can't add characters and numbers
|domain error
   _5 # 1     NB. Can't make _5 copies of y
|domain error
   1: b. _1   NB. Can't find an inverse for this verb
|domain error

domain error can occur during assembly of the final result of a verb, even though the verb executed correctly on every cell, if the results cannot be asssembled into a single array.

   ]a =. 5;'a'
+-+-+
|5|a|
+-+-+
   >a
|domain error
|       >a

Each box can be opened, but the results cannot be put into a single array.

Warning.png domain error (on an assignment)

Public assignment to a name that has been privately assigned is an error:

   tv =: monad define
nm =. y  NB. private assignment
nm =: y  NB. public assignment
)
   tv 5
|domain error: tv
|   nm    =:y

The reason is that the public name will not be visible while the private namespace is active, so you probably blundered.

If you really want to make a public assignment to a privately assigned name, you must use a locative, like this:

   NB. save copies of the arguments this verb is called with
   savexy=: 4 : 0
y__   =: y   NB. arguments x and y behave like privately assigned names.
x__   =: x   NB. x__ is the same as x_base_
)

Use these (and similar) sentences when debugging an explicit definition.

TIP: If you add extra spaces before =: (as shown above) it makes it easy to find them again, for subsequent removal.

Warning.png domain error (pun in definition)

A name has changed parts of speech and is being referred to in a sentence that expects it to have a different part of speech:

   z =. +:
   a =. z
   a   NB. a refers to z, as a verb
z
   a 5
10
   z =. 10  NB. But now z is a noun!
   a 5
|domain error: z
|       a 5

Warning.png file name error

File not found or device not found.

Typical mistakes:

1. Trying to load a script that isn't there

   load 'nosuchscript'
not found: /Applications/j602/nosuchscript
|file name error: script
|       0!:0 y[4!:55<'y'

In this case the verb  load executes a smoutput line telling you the name of the missing file. But if you use built-in file handling verbs like  0!:0 directly then the  file name error message is all you'll see. This doesn't tell you the name of the missing file, which is hidden inside noun: y.

2. Accessing a nonexistent device.

   '' 1!:2 <'q:/file.txt'  NB. I have no Q: disk
|file name error
|   ''    1!:2<'q:/file.txt'

Warning.png file number error

There is no file currently open with that number.


Warning.png fixed-precision error

    (6 c. 30000) + (6 c. 10000)  NB. type 6 is 2-byte signed integers, max value 32767
|fixed-precision error
|   (6 c.30000)    +(6 c.10000)

The fixed-precision types integer2 and integer4 do not promote values to higher precision on overflow. They simply signal an error.


Warning.png fold limit

You executed _3 Z: y to impose a limit on the number of iterations of the Fold. The Fold had been executed at least y times.


Warning.png ill-formed name

Your name doesn't follow the name rules.

Usually this is because of underscores.

Most other bad characters result in  ill-formed number or  syntax error .

   name__name_   NB. Object names in an object locative must not contain underscore
|ill-formed name: name__name_
   name_000_    NB. Illegal numeric locale name
|ill-formed name: name_000_
   a =. <'000'
   name__a     NB. Illegal numeric locale name
|ill-formed name: a
|       name__a

Warning.png ill-formed number

Every word that starts with one of _0123456789 must be a valid number according to the rules for constants. If it's not, J signals  ill-formed number .

J detects an invalid number when you define a verb explicitly. But all J tells you is the starting line of the definition. You have to look right through the verb definition to find the bad character.

File a.ijs contains the text

   vill =: monad define
a =. 5
b =. 6
if. y do. c =. 7t end.     NB. The bad character is: t
d =. 5
)

When the script is loaded, you will see

   load'a.ijs'
|ill-formed number
|   c =. 7t
|        ^
|   vill=:monad     define
|[-5] C:\git\jsource2019\makevs\jdll\a.ijs

The -5 says the failing definition ends at line 5. It is up to you to find the line containing the invalid text. Typical mistakes:

1. Writing scientific notation for a number with (-) instead of (_)

   1 + 1E-5
|ill-formed number
   1 + 1E_5
1.00001

2. Omitting a space after a number

x =: verb define
if. x > 1do.
end.
)
|ill-formed number
|   x=:    3 :0

Warning.png index error

You have overstepped the bounds of an array, or you have an argument that is too long or short for its context.

Typical mistakes:

1. Forgetting that a list of length n starts with item 0 and ends with item (n-1)

   1{ 'abc'
b
   2{ 'abc'
c
   3{ 'abc'
|index error
|   3    {'abc'

Warning.png interface error

Your sentence resulted in a request to the operating system that was rejected, or to a J component that has not been installed.

   1!:1 <'C:/temp?.txt'   NB. Destination folder OK. but invalid character in filename
|interface error
   1000x   NB. extended arithmetic requires the GMP math library but you haven't installed it
|interface error

To install GMP, issue

   install 'gmp'

or, on Linux, install it from your distribution.



Warning.png length error

One of these cases has arisen:

  • This verb's x- and y-arguments must agree
  • an argument has an expected size, but you didn't honor it.

Typical mistakes:

1. Forgetting the length of a noun you've assigned earlier

   z=: i.3
   z + 1 10 100
1 11 102
   z + 1 10 100 1000
|length error
|   z    +1 10 100 1000

2. Supplying too long an argument to a verb that operates on each axis of the other argument

Example: the x argument of ({.) or ({)

   1 2 3 {. i. 4     NB. One value of x per axis, but there is only 1 axis
|length error
   (<0 1 2) { i. 4   NB. One value per axis, but there is only 1 axis.  You meant <<0 1 2 or just 0 1 2
|length error

3. Supplying the wrong amount of information to a verb

   (,<2) ;: 3 4 5    NB. (;:) wants x to have 2-4 items
|length error

Warning.png limit error

1. You have used a number that is outside J's limits:

J Limits
Value Maximum Value
Print precision 20
Comparison tolerance 2^_34 (5.82077e_11)

2. You have used a number outside the range of accuracy of a verb

   1 o. 1e16   NB. sin needs some fractional accuracy
|limit error

Oddity: invalid starting point in ;.0 is reported as a limit error.

   (,. 5 0) ]"];.0 i. 4
|limit error

Setting a too-large comparison tolerance generates a domain error.

Typical mistakes: 1. Trying to set a large print precision

   ":!.25 (5.4)
|limit error

Warning.png locale error

You tried to access a numbered locale that does not exist. This is not allowed.

   18!:3 ''   NB. Create numbered locale
+-+
|8|
+-+
   a_8_ =. 5
   18!:55 <'8'   NB. Destroy it
1
   a_8_    NB. You can't go back to it
|locale error
|       a_8_

Warning.png NaN error

NaN, the IEEE-754 "Not a number", is a "data virus" that produces anomalous results and spreads its corruption through computations it takes part in. It should be avoided wherever possible. A numeric computation that would produce NaN will fail with NaN error.

The operations that would produce NaN are:

  • adding infinities of opposite signs, or equivalent operations (including p., H., and T.
  • *y when y has infinite real and imaginary parts
  • x % y or x ! y when x and y are infinite
  • x ^. y when both x and y are infinite or zero

Warning.png no result

You coded a Fold that did not execute anything that could be used to make a result.

  • You executed Z: to end the Fold before any results had been accumulated
  • You executed the Fold on an empty array, which would normally return (u v/ array), but (v/ could not be executed because v does not have an identity element.

Warning.png nonce error

The operation you requested is meaningful but not currently supported. So, for the time being (for the nonce), rephrase it.

   s =. $. 3 3 ?@$ 100   NB. Create a sparse matrix
   %. s    NB. Oops, sparse-matrix inversion not supported.
|nonce error

Warning.png non-unique sparse elements

When an operation is performed on a sparse array, it is applied to the elements of the array and also to the sparse element. This is illegal if it would leave the sparse element containing atoms with different values

   ($. 2 2 $ 0) ,"1 (1 2)
|non-unique sparse elements
|   ($.2 2$0)    ,"1(1 2)

Warning.png noun result was required

The result of a verb must be a noun.

   f =: verb define
+
)
   f 5
|noun result was required: f
|   +

Also, tests following if., elseif., for., while., whilst., select., case., and fcase. must also end with noun results.

   f =: verb define
if. y > undefinedname do.
  y =. 3 * y
end.
y
)
   f 5
|noun result was required
|   y > undefinedname

Important.png A PUZZLING PROBLEM:

Sometimes J consistently signals  noun result was required when you execute an explicit definition
whose body consists entirely of good lines.

Maybe the last phrase to be executed defines a verb, not a noun?

To fix this problem, insert:  i.0 0 as the last line (see below).

Typical mistake:

Deliberately assigning a verb inside the body of an explicit definition, and then forgetting to override it with a (dummy) noun before exiting the verb.
NB. anonymous verb in script to customize a platform-dependent verb
3 : 0 ''
if. IFWIN do.
  myverb =: myverb_WIN
else.
  myverb =: myverb_OTHER
end.
i.0 0   NB. don't forget this line, else J signals 'noun result was required'
)

TIP: If the whole purpose of your verb is to customize one or more verbs for later use, get in the habit of writing  i.0 0 or  empty'' as the last line of the body.


Warning.png open quote

Mismatched quotes.

Typical mistakes:

1. Forgetting to escape a quote inside a quoted string by doubling it.

   a =. 'Casey's Tool Works'
|open quote
|      a =. 'Casey's Tool Works'
|                              ^

2. Applying Do (".) to a string containing an apostrophe -- which J reads as an unmatched quote.

   s =. 'Casey''s Tool Works'
   ". s
|open quote
|   Casey's Tool Works
|        ^
|       ".s

Warning.png out of memory

There is not enough virtual memory to hold the size of noun you've created.

J asks the operating system for memory as needed. It has no control over the amount of memory available. Depending on your system, J may be sharing memory with other tasks.

Typical mistakes:

1. A loop that creates extra values has run out of control.


Warning.png rank error

An argument or operand has an invalid rank. This depends on the details of the verb or modifier being executed.

Note that an invalid rank for an argument of a verb must always be smaller than the rank of the verb, because that is the largest rank the verb itself is presented with.

Typical mistakes:

1. Wrong rank for a throwaway argument

   9!:8 'a'   NB. expects ''
|rank error

2. Wrong rank for a control argument

   (<1 1$a:) { i. 2 3
|rank error
   0 1 ". '34 56'   NB. x must be a scalar
|rank error

Warning.png security violation

When the security level has been set to 1 by executing  (9!:25)1 , all verbs able to alter the environment outside J are prohibited. If you run such a verb then J signals  security violation .

All the prohibited verbs are, or contain Foreigns:

  • the dyads of  0!:n (script execution)
  • 1!:n (file operations) except for 1!:43 (Query Working Directory) and 1!:44 (Set Working Directory)
  • 2!:n (host services)
  • 15!:n (DLLs and memory management).

Warning.png spelling error

J signals this error when

  • you used a non-ASCII character (not in quotes) in a sentence
  • you put a period or colon in a bad place, to make a bad word
  • you use a control word outside an explicit definition.

All inflected words, i.e. ending in period or colon, must be predefined in J.

Typical mistakes:

  1. Spelling a control word wrong.
  2. Adding an extra period or colon.
  3. Using a non-ASCII character (most insidiously, a non-breaking space)
  4. Typing a control structure into the execution window, or in a script outside an explicit definition.

Warning.png stack error (during debugging)

You attempted to redefine a name that is suspended. It is OK to reload the verb that is being executed; debugging will continue using the new text. But it is forbidden to reload any other suspended name.


Warning.png stack error (recursion error)

The maximum subroutine depth is pretty big — 10000 or so. If you exceed that, it is almost certainly because you've had an infinite recursion.

   toodeep =: verb define
toodeep y
)
   toodeep 4
|stack error: toodeep

Warning.png syntax error (invalid sentence)

Execution of a sentence involves finding executable fragments, executing them, and replacing them with the result of the execution. This is done until all the executable fragments have been executed. There should be a single value left. If not, the sentence contains a syntax error.

Typical mistakes:

1. Putting two nouns next to each other, forgetting that they need an intervening verb

   4 + 5 6   NB. 5 6 is one word, so doesn't need to be joined by ,
9 10
   'five six' =. 5 6
   4 + five six   NB. names need to be joined
|syntax error

2. Using: (noun verb) as if it were a hook (it's not a hook!)

   (5 +) 6
|syntax error

3. Leaving out a verb in a long composition of verbs

   %:@:(+/)@@*:   NB. Oops, 2 conjunctions in a row: @@
|syntax error

Warning.png time limit

The time limit set by 9!:33 was exceeded.

When the time limit is nonzero, it is reduced according to the time taken by sentences. J signals  time limit when the remaining time goes to 0.


Warning.png uncaught throw.

You executed a throw. control word, but there was no catcht. block to handle it. Execution terminates at the point of the throw.


Warning.png valence error

You tried to execute a verb, but the verb does not have a definition for the valence you used.

   add =: {{x + y}}
   add 5   NB. only the dyadic valence is defined
valence error

The [: verb has no defined valence, and always produces valence error when it is executed.
in the form ([: g h) the [: indicates a capped fork and is not executed.



Warning.png value error

You have asked the interpreter to evaluate a name that has not been defined.

There is more to this error than meets the eye.

  • A noun, adverb, or conjunction is evaluated when it is encountered during the right-to-left execution of a sentence.
  • A verb is evaluated
      • when it is executed with its (noun) argument(s) or
      • when you type the name of the verb into the j session window as the only word in a line, whereupon the verb needs to be evaluated for display purposes.

This leaves many situations where undefined verbs do not cause  value error .

Rightly so, since it is important to permit mutually-referencing verbs.

For example, typing this sentence into the J session

   undefname

will result in  value error because you are asking J to display the value of the undefined name.

But the sentence

   myname =: undefname

will not cause an error because myname is defined to be a reference to undefname . But undefname does not yet need to be evaluated.

J assumes the undefined name: myname is a verb of infinite rank that has yet to be defined.

Subsequently

   myname
undefname

causes no error because myname has in fact been defined, i.e. in terms of  undefname .

But if you now force the interpreter to use myname

   myname 5
|value error: undefname
|       myname 5

the underlying undefined name: undefname is now exposed.

If you type

   undefname1 undefname2
undefname1 undefname2

... J does not signal  value error because you have not asked J to display the value of either undefname1 or undefname2 .

By default, J assumes  undefname1 undefname2 to be a train of two verbs — which forms a hook. You've asked J to display only the hook (which is a verb). Although this verb consists of references to the two said undefined verbs, neither of them needs to be evaluated just yet.

If it is inside a verb definition, an undefined name is not required to be evaluated for display purposes.

Thus it may escape your notice, even if it appears in a lengthy sentence.

   everb =: 3 : 0
total =. +/ y
undefname
undefname1 undefname2
undefname1 undefname2 undefname3
sqtotal =. *: totals
meantotal =. (+/ % #) sqtotal
y
)
   everb 5
5

Every line (except the first and the last) contains undefined names. Thus they're all garbage.
However, the verb works ok. J never signals  value error because none of the bad lines actually executes a verb with an argument. (Arguments must of course be nouns.)

All the bad lines simply create new verbs -- and then do nothing with them.

Important.png REMEMBER:

  • Misspelled words in a verb definition will not always cause J to signal an error.
  • And the verb may even appear to work ok.

Information.png Use the addon: lint to perform a static analysis of name assignment, which will find any undefined names.


Warning.png would deadlock

You tried to perform an action that would lock up the system. An example is opening an unfinished pyx while in debug suspension: the debug thread will wait for the pyx to be filled, but it never will be because all other threads are stopped.