Section 6: All the Inform error messages

Contents Back Forward | ### 6. All the Inform error messages
| Three kinds of error are reported by Inform: a fatal error is a breakdown severe enough to make Inform stop working at once; an error allows Inform to continue for the time being, but will cause Inform not to finally output the story file (this is to prevent damaged story files being created); and a warning means that Inform suspects you may have made a mistake, but will not take any action itself. #### Fatal errors 1. Too many errors
    Too many errors: giving up
After 100 errors, Inform stops (in case it has been given the wrong source file altogether, such as a program for a different language altogether). 2. Input/output problems Most commonly, Inform has the wrong filename:
    Couldn't open input file <filename>
    Couldn't open output file <filename>
(and so on). More seriously the whole process of file input/output (or "I/O'') may go wrong for some reason to do with the host computer: for instance, if it runs out of disc space. Such errors are rare and look like this:
    I/O failure: couldn't read from temporary file 2
Normally you can only have at most 64 files of source code in a single compilation. If this limit is passed, Inform generates the error
    Program contains too many source files: increase #define MAX_SOURCE_FILES
(This might happen if the same file accidentally `Include`s itself.) Finally, if a non-existent pathname variable is set in ICL, the error
    No such path setting as <name>
is generated. 3. Running out of memory If there is not enough memory even to get started, the following appear:
    Run out of memory allocating <number> bytes for <something>
    Run out of memory allocating array of <number>x<number> bytes for <something>
(There are four similar `hallocate` errors unique to the PC 'Quick C' port.) More often memory will run out in the course of compilation, like so:
    The memory setting <setting> (which is <value> at present) has been exceeded.
    Try running Inform again with $<setting>=<some-larger-number> on the command line.
(For details of memory settings, see Section 5 above.) In a really colossal game, it is just conceivable that you might hit
    One of the memory blocks has exceeded 640K
which would need Inform to be recompiled to get around (but I do not expect anyone ever to have this trouble). Much more likely is the error
    The story file/module exceeds version <n> limit (<number>K) by <number> bytes
If you're already using version 8, then the story file is full: you might be able to squeeze more game in using the `Abbreviate` directive, but basically you're near to the maximum game size possible. Otherwise, the error suggests that you might want to change the version from 5 to 8, and the game will be able to grow at least twice as large again. #### Errors There are a few conventions. Anything in double-quotes is a quotation from your source code; other strings are in single-quotes. The most common error by far takes the form
    Expected ... but found ...
(of which there are over 100 kinds): most are straightforward to sort out, but a few take some practice. One of the trickiest things to diagnose is a loop statement having been misspelt. For example, the lines
        pritn "Hello";
        While (x==y) print "x is still y^";
produce one error each:
    line 1: Error: Expected assignment or statement but found pritn
    line 2: Error: Expected ';' but found print
The first is fine. The second is odd: a human immediately sees that `While` is meant to be a `while` loop, but Inform is not able to make textual guesses like this. Instead Inform decides that the code intended was
        While (x==y); print "x is still y^";
with `While` assumed to be the name of a function which hasn't been declared yet. Thus, Inform thinks the mistake is that the `;` has been missed out. In that example, Inform repaired the situation and was able to carry on as normal in subsequent lines. But it sometimes happens that a whole cascade of errors is thrown up, in code which the user is fairly sure must be nearly right. What has happened is that one syntax mistake threw Inform off the right track, so that it continued not to know where it was for many lines in a row. Look at the first error message, fix that and then try again. 1. Reading in the source-code
    Illegal character found in source: (char) <hexadecimal number>
    Unrecognised combination in source: <text>
    Alphabetic character expected after <text>
    No such accented character as <text>
    Name exceeds the maximum length of <number> characters: <name>
    The following name is reserved by Inform for its own use as a routine name;
        you can use it as a routine name yourself (to override the standard
        definition) but cannot use it for anything else: <name>
    The obsolete '#w$word' construct has been removed
    Binary number expected after '$$'
    Hexadecimal number expected after '$'
    Too much text for one pair of 's to hold
    Too much text for one pair of "s to hold
Note that, for instance, a `^` character is illegal in ordinary source code (producing the first error above), but is allowed within quotation marks. 2. Variables and arrays
    Variable must be defined before use: <name>
    '=' applied to undeclared variable
    Local variable defined twice: <name>
    All 236 global variables already declared
    No array size or initial values given
    Array sizes must be known now, not externally defined
    An array must have a positive number of entries
    A 'string' array can have at most 256 entries
    Entries in byte arrays and strings must be known constants
    Missing ';' to end the initial array values before "[" or "]"
The limit of 236 global variables is absolute: a program even approaching this limit should probably be making more use of object properties to store its information. "Entries... must be known constants'' is a restriction on what byte or string arrays may contain: basically, numbers or characters; defined constants (such as object names) may only be used if they have already been defined. This restriction does not apply to the more normally used word and table arrays. 3. Routines and function calls
    No 'Main' routine has been defined
    It is illegal to nest routines using '#['
    A routine can have at most 15 local variables
    Argument to system function missing
    System function given with too many arguments
    Only constants can be used as possible 'random' results
    A function may be called with at most 7 arguments
    Duplicate definition of label: <name>
Note that the system function `random`, when it takes more than one argument, can only take constant arguments (this enables the possibilities to be stored efficiently within the program). Thus `random(random(10), location)` will produce an error. To make a random choice between non-constant values, write a `switch` statement instead. 4. Expressions and arithmetic
    Missing operator: inserting '+'
    Evaluating this has no effect: <operator>
    '=' applied to <operator>
    Brackets mandatory to clarify order of: <operator>
    Missing operand for <operator>
    Missing operand after <something>
    Found '(' without matching ')'
    No expression between brackets '(' and ')'
    'or' used improperly
    Division of constant by zero
    Label name used as value: <name>
    System function name used as value: <name>
    No such constant as <name>
"Operators'' include not only addition `+`, multiplication `*` and so on, but also more exotic Inform constructs like `-->` ("array entry'') and `.` ("property value''). An example of an operator where "Evaluating this has no effect'' is in the statement
        34 * score;
where the multiplication is a waste of time, since nothing is done with the result. "= applied to operator'' means something like
        (4 / fish) = 7;
which literally means "set $4/$`fish` to 7'' and results in the error "= applied to /''. "Brackets mandatory to clarify order'' means that an ambiguous expression like
        frogs == ducks == geese
requires clarification: which `==` is to be worked out first? 5. Miscellaneous errors in statements
    'do' without matching 'until'
    'default' without matching 'switch'
    'else' without matching 'if'
    'until' without matching 'do'
    'break' can only be used in a loop or 'switch' block
    At most 32 values can be given in a single 'switch' case
    Multiple 'default' clauses defined in same 'switch'
    'default' must be the last 'switch' case
    'continue' can only be used in a loop block
    A reserved word was used as a print specification: <name>
    No lines of text given for 'box' display
    In Version 3 no status-line drawing routine can be given
    The 'style' statement cannot be used for Version 3 games
For instance, `print (fixed) X` gives the "reserved word in print specification'' error because `fixed` is a reserved statement internal keyword. Anyway, call such a printing routine something else. 6. Object and class declarations
    Two textual short names given for only one object
    The syntax '->' is only used as an alternative to 'Nearby'
    Use of '->' (or 'Nearby') clashes with giving a parent
    '->' (or 'Nearby') fails because there is no previous object
    '-> -> ...' fails because no previous object is deep enough
    Two commas ',' in a row in object/class definition
    Object/class definition finishes with ','
    Not an individual property name: <name>
    No such property name as <name>
    Not a (common) property name: <name>
    Property should be declared in 'with', not 'private': <name>
    Limit (of 32 values) exceeded for property <name>
    Duplicate-number not known at compile time
    The number of duplicates must be 1 to 10000
Note that "common properties'' (those provided by the library, or those declared with `Property`) cannot be made `private`. All other properties are called "individual''. The "number of duplicates'' referred to is the number of duplicate instances to make for a new class, and it needs to be a number Inform can determine now, not later on in the source code (or in another module altogether). The limit 10000 is arbitrary and imposed to help prevent accidents. 7. Grammar
    Two different verb definitions refer to <name>
    There is no previous grammar for the verb <name>
    There is no action routine called <name>
    No such grammar token as <text>
    '=' is only legal here as 'noun=Routine'
    Not an action routine: <name>
    This is a fake action, not a real one: <name>
    Too many lines of grammar for verb: increase #define MAX_LINES_PER_VERB
At present verbs are limited to 20 grammar lines each, though this would be easy to increase. (A grammar of this kind of length can probably be written more efficiently using general parsing routines, however.) 8. Conditional compilation
    'Ifnot' without matching 'If...'
    Second 'Ifnot' for the same 'If...' condition
    End of file reached in code 'If...'d out
    This condition can't be determined
"Condition can't be determined'' only arises for `Iftrue` and `Iffalse`, which make numerical or logical tests: for instance,
        Iftrue #strings_offset==$4a50;
can't be determined because even though both quantities are constants, the `#strings_offset` will not be known until compilation is finished. On the other hand, for example,
        Iftrue #version_number>5;
can be determined, as the version number was set before compilation. 9. Miscellaneous errors in directives
    You can't 'Replace' a system function already used
    Must specify 0 to 3 local variables for 'Stub' routine
    A 'Switches' directive must come before the first constant definition
    All 48 attributes already declared
    All 62 properties already declared
    'alias' incompatible with 'additive'
    The serial number must be a 6-digit date in double-quotes
    A definite value must be given as release number
    A definite value must be given as version number
    The version number must be in the range 3 to 8
    All 64 abbreviations already declared
    All abbreviations must be declared together
    It's not worth abbreviating <text>
    'Default' cannot be used in -M (Module) mode
    'LowString' cannot be used in -M (Module) mode
10. Linking and importing
    File isn't a module: <name>
    Link: action name clash with <name>
    Link: program and module give differing values of <name>
    Link: module (wrongly) declared this a variable: <name>
    Link: this attribute is undeclared within module: <name>
    Link: this property is undeclared within module: <name>
    Link: this was referred to as a constant, but isn't: <name>
    Link: <type> <name> in both program and module
    Link: <name> has type <type> in program but type <type> in module
    Link: failed because too many extra global variables needed
    Link: module (wrongly) declared this a variable: <name>
    Link: this attribute is undeclared within module: <name>
    Link: this property is undeclared within module: <name>
    Link: this was referred to as a constant, but isn't: <name>
    'Import' cannot import things of this type: <name>
    'Import' can only be used in -M (Module) mode
Note that the errors beginning "Link:'' are exactly those occurring during the process of linking a module into the current compilation. They mostly arise when the same name is used for one purpose in the current program, and a different one in the module. 11. Assembly language
    Label out of range for branch
    Opcode specification should have form "VAR:102"
    Unknown flag: options are B (branch), S (store),
        T (text), I (indirect addressing), F** (set this Flags 2 bit)
    Only one '->' store destination can be given
    Only one '?' branch destination can be given
    No assembly instruction may have more than 8 operands
    This opcode does not use indirect addressing
    Indirect addressing can only be used on the first operand
    Store destination (the last operand) is not a variable
    Opcode unavailable in this Z-machine version: <name>
    Assembly mistake: syntax is <syntax>
    Routine contains no such label as <name>
    For this operand type, opcode number must be in range <range>
12. None of the above If you should see an incomprehensible error message beginning with `***`, then Inform itself has malfunctioned. This is not meant to happen, but it's conceivable that it might occur in the process of linking in a module which has been damaged in some way. Finally, error messages can also be produced from within the program (deliberately) using `Message`. It may be that a mysterious message is being caused by an included file written by someone other than yourself. #### Warnings 1. Questionable practices
    This statement can never be reached
There is no way that the statement being compiled can ever be executed when the game is played. Here is an obvious example:
        return; print "Goodbye!";
where the `print` statement can never be reached, because a `return` must just have happened. Beginners often run into this example:
        "You pick up the gauntlet."; score=score+1; return;
Here the `score=score+1` statement is never reached because the text, given on its own, means "print this, then print a new-line, then return from the current routine''. The intended behaviour needs something like
        print "You pick up the gauntlet.^"; score=score+1; return;
    <type> <name> declared but not used
For example, a `Global` directive was used to create a variable, which was then never used in the program.
    '=' used as condition: '==' intended?
Although a line like
        if (x = 5) print "My name is Alan Partridge.";
is legal, it's probably a mistake: `x=5` sets `x` to 5 and results in 5, so the condition is always true. Presumably it was a mistype for `x==5` meaning "test `x` to see if it's equal to 5''.
    Unlike C, Inform uses ':' to divide parts of a 'for' loop
        specification: replacing ';' with ':'
Programmers used to the C language will now and then habitually type a `for` loop in the form
        for (i=0; i<10; i++) ...
but Inform needs colons, not semicolons: however, as it can see what was intended, it makes the correction automatically and issues only a warning.
    Missing ','? Property data seems to contain the property name <name>
The following, part of an object declaration, is legal but unlikely:
        with found_in MarbleHall
             short_name "conch shell", name "conch" "shell",
As written, the `found_in` property has a list of three values: `MarbleHall`, `short_name` and `"conch shell"`. `short_name` throws up the warning because Inform suspects that a comma was missed out and the programmer intended
        with found_in MarbleHall,
             short_name "conch shell", name "conch" "shell",
    This is not a declared Attribute: <name>
Similarly, suppose that a game contains a `pen`. Then the following `give` statement is dubious but legal:
        give MarbleDoorway pen;
The warning is caused because it's far more likely to be a misprint for
        give MarbleDoorway open;
    Without bracketing, the minus sign '-' is ambiguous
For example,
        Array Doubtful --> 50 10 -20 56;
because Inform is not sure whether this contains three entries, the middle one being $10-20=-10$, or four. It guesses four, but suggests brackets to clarify the situation.
    Array entry too large for a byte
Byte `->` and `string` arrays can only hold numbers in the range 0 to 255. If a larger entry is supplied, only the remainder mod 256 is stored, and this warning is issued.
    Verb disagrees with previous verbs: <verb>
The `Extend only` directive is used to cleave off a set of synonymous English verbs and make them into a new Inform verb. For instance, ordinarily "take'', "get'', "carry'' and "hold'' are one single Inform verb, but this directive could split off "carry'' and "get'' from the other two. The warning would arise if one tried to split off "take'' and "drop'' together, which come from different original Inform verbs. (It's still conceivably usable, which is why it's a warning, not an error.)
    This does not set the final game's statusline
An attempt to choose, e.g., `Statusline time` within a module, having no effect on the program into which the module will one day be linked. Futile.
    This module has a more advanced format than this release of the
        Inform 6 compiler knows about: it may not link in correctly
2. Obsolete usages
    more modern to use 'Array', not 'Global'
    use '->' instead of 'data'
    use '->' instead of 'initial'
    use '->' instead of 'initstr'
    use 'word' as a constant dictionary address
    '#a$Act' is now superceded by '##Act'
    '#n$word' is now superceded by ''word''
    '#r$Routine' can now be written just 'Routine'
    all properties are now automatically 'long'
    use the ^ character for the apostrophe in <dictionary word>
These all occur if Inform compiles a syntax which was correct under Inform 5 (or earlier) but has now been withdrawn in favour of something better.
| No Inform library file (or any other file marked `System_file`) produces warning messages. It may contain many declared but unused routines, or may contain obsolete usages for the sake of backward compatibility.

Contents / Back / Forward
Chapter I / Chapter II / Chapter III / Chapter IV / Chapter V / Chapter VI / Appendix

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.