Ghostscript error messages

Table of contents

For other information, see the Ghostscript overview, the new user's documentation on previewers and, if necessary, how to install Ghostscript.


General error information

Error messages from ghostscript are usually caused by incorrect PostScript or PDF input. Occasionally the cause is a bug in ghostscript itself. See Reporting Ghostscript problems. This document explains some common error messages from ghostscript.

Example error message

An example of a ghostscript error message is shown below, followed by an explanation. It is assumed that you have a basic knowledge of the PostScript language.

  AFPL Ghostscript 7.04 (2002-01-31)
  Copyright (C) 2001 artofcode LLC, Benicia, CA.  All rights reserved.
  This software comes with NO WARRANTY: see the file PUBLIC for details.
  GS>1 2 3 junk
  Error: /undefined in junk
  Operand stack:
     1   2   3
  Execution stack:
     %interp_exit   .runexec2   --nostringval--   --nostringval--   
     --nostringval--   2   %stopped_push   --nostringval--   
     --nostringval--   %loop_continue   2 3   %oparray_pop   
     --nostringval--   --nostringval--   false   1   %stopped_push   
     .runexec2   --nostringval--   --nostringval--   --nostringval--   2   
     %stopped_push   --nostringval--   --nostringval--   --nostringval--
  Dictionary stack:
     --dict:1004/1123(ro)(G)--   --dict:0/20(G)--   --dict:67/200(L)--
  Current allocation mode is local
  Last OS error: No such file or directory
  Current file position is 11
  GS<3>

Explanation:

  AFPL Ghostscript 7.04 (2002-01-31)
Check which version of ghostscript you are using, and make sure you have the latest release. 7.04 is not the latest release.

  GS>1 2 3 junk
At the GS> prompt, the user told ghostscript to push the integers 1, 2 and 3 onto the stack, then to execute the procedure or operator named junk.

  Error: /undefined in junk
Here is the start of the error message, which has two parts. The first is the error type, in this case /undefined, the second is the object being executed, which may be a PostScript operator, procedure or a name. In this case, the error message is saying that the name junk does not exist in any dictionary. See PostScript error types for explanations of each error type.

  Operand stack:
     1   2   3
Operators and procedures usually act on arguments provided on the operand stack. The top of the stack is at the right. An error might occur because the wrong operands are on the stack.

  Execution stack:
     %interp_exit ... --nostringval--
The execution stack contains a list of operators and procedures that are being executed. Sometimes this is useful for identifying the context of the error.

  Dictionary stack:
     --dict:1004/1123(ro)(G)--   --dict:0/20(G)--   --dict:67/200(L)--
Ghostscript searches for names in the dictionaries on the stack, starting with the top of the stack. There are always at least three dictionaries on the stack, systemdict, globaldict and userdict. systmedict is read-only (ro). systemdict and globaldict are in global memory (G), while userdict is in local memory (L). userdict has room for 200 entries, of which 67 are used. Common errors are to try to write to a read-only dictionary, to try to put something in a global dictionary that refers to local memory, or to not have the correct dictionaries on the stack.

  Current allocation mode is local
Compound ojects can be created in local memory (can be cleaned up by save/restore) or in global memory. Both memory types are subject to garbage collection. The allocation mode is usually local, but needs to be global when putting objects in a global dictionary.

  Last OS error: No such file or directory
Irrelevant to this error message, but if there was an ioerror, the last operating system error might give another clue.

  Current file position is 11
The error occured when ghostscript had read 11 bytes from the input file, in this case just after it read the work junk.

  GS<3>
There are three items left on the operand stack.

Tips

Try to reproduce the error using ghostscript alone, without using a previewer.

If there are items on the stack, display them using pstack. This will give more detail than the brief stack dump in the error message.


Ghostscript error messages

Can't find initialization file gs_init.ps

Ghostscript looks for its library files in the directories listed in the output of gs -h. If the files are in a different location, see how ghostscript finds files.

Unable to open the initial device, quitting

During initialization, ghostscript opens an output device. Typical output devices include the display, a bitmap output device, a printer output device or the PDF writer output device. This message occurs when the initial output device can not be opened. Some possible reasons are:

Unknown device:

The device selected by -sDEVICE= does not exist. The device name may be wrong, or it may not be included in your copy of ghostscript. Some additional device can be added to ghostscript when it is compiled.

Unrecoverable error: rangecheck in .putdeviceprops.

This occurs on startup if a device parameter is invalid. For example, gs -dTextAlphaBits=3.

PostScript error types

Here are some standard PostScript error types and some possible causes. Look in the PostScript Language Reference for more details.

dictfull

dictstackoverflow

dictstackunderflow

execstackoverflow

interrupt

invalidaccess

invalidexit

invalidfileaccess

invalidfont

invalidrestore

ioerror

limitcheck

nocurrentpoint

rangecheck

stackoverflow

stackunderflow

syntaxerror

timeout

typecheck

undefined

undefinedfilename

undefinedresult

unmatchedmark

VMerror


Copyright © 2002, artofcode LLC. All rights reserved.

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861.

Ghostscript version 7.30, 7 September 2002