Lesson12 – Troubleshooting AutoLISP Files

Whenever you work with AutoLISP you will come across errors. Sometimes this is nothing more than a misspelling of a function or, very often, the wrong number of parentheses. Below are some common errors and some possible solutions.

Explanation: the (type) function

The “error: bad argument” message means that you have used the wrong data type. Quite often the arguments will be stored in a symbol so you will not be able to see what type of data it is. You can use the AutoLISP function (type) to find out.

(type element)


Command: (setq A 1.0)
(type A)

Command: (type “This is”)

Command: (type 1783)

Using Visual LISP’s Check Function

Before you load a file it is a good idea to check it. Check Edit Window and Check Selection will tell you if you have too many or two few arguments to a known function.

  • Any error messages will be shown in a Build Output window.

  • If you double-click on the error in the Build Output window it will highlight the appropriate lines in the AutoLISP code.
  • Some problems will not come clear until you actually load the command. For example, Check cannot tell if you need an integer and you passed on a string. Use the (type) command or other debugging tools if you have this problem.


In this practice we will create some problems for the BOX1.LSP file and then use tools in Visual LISP to fix the problems. Estimated time for completion: 5 minutes.

1. Continue using BOX1.LSP.

2. Erase the closing quote mark (“ ) after one of the prompts. Notice how the color of all the following lines change. Where does the new string end?

3. Double-click in front of the opening parenthesis of that same line. What happens?

4. Add a close quote and two close parentheses at the end of the file. Try double-clicking at the same place again.

5. Check the whole file. What happens?

6. Double-click on the error message in the Build Output window.

7. What is highlighted?

8. Fix the problem(s), check the routine again, and run it to make sure it works.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons

It's FREE!

Sign up and receive an email every time a new tutorial is published