An existence error occurs when a predicate attempts to access something that does not exist. For example, trying to compile a file that does not exist, erasing a database reference that has already been erased. A less obvious example: reading past the end of file marker in a stream is regarded as asking for an object (the next character) that does not exist.
The SICStus_Error term associated with an existence error is
existence_error(Goal, ArgNo, ObjectType, Culprit, Message)
0
or ''
, or
some additional information provided by the operating system or other
support system indicating why Culprit is thought not to exist.
For example, ‘see('../brother/niece')’ might raise the exception
existence_error(see('../brother/niece'), 1, file, '/usr/stella/parent/brother/niece', errno(20))
where the Message encodes the system error ENOTDIR
(some component
of the path is not a directory).
As a general rule, if Culprit was provided in the goal as some sort of context-sensitive name, the Prolog system will try to resolve it to an absolute name, as shown here, so that you can see whether the problem is just that the name was resolved in the wrong context.