Ad Space — Top Banner

Line does not exist

Amstrad Retro Computer

Severity: Minor

What Does This Error Mean?

'Line does not exist' fires when GOTO, GOSUB, RESTORE, or THEN points to a line number that isn't in the program.
Either you mistyped the destination, deleted the line at some point, or used a calculated line number that's wrong.
LIST the program, find the bad reference, and fix the number.

Affected Models

  • Amstrad CPC 464
  • Amstrad CPC 664
  • Amstrad CPC 6128
  • Amstrad CPC 464 Plus
  • Amstrad CPC 6128 Plus

Common Causes

  • Typo in GOTO line number — GOTO 200 when target is 220
  • Deleted the destination line and forgot to update GOTO
  • RENUMber moved lines but text outside line numbers stayed
  • Calculated GOTO produced a non-existent number

How to Fix It

  1. Find the offending line.

    The error reports the line number that contains the bad jump.
    LIST that line.
    The GOTO/GOSUB/THEN inside it points somewhere that doesn't exist.

  2. List the rest of the program.

    Type LIST and scroll through.
    Look for the destination number — does it exist?
    If not, that's why it failed.

  3. Either fix the destination or add the line.

    If the destination is a typo, edit the line and correct the number.
    If the destination should exist, add it as a new line.
    Even a single REM line at that number lets the jump succeed (then place real code after).

  4. Be careful with RENUM.

    RENUM updates GOTO/GOSUB/THEN inside listed code, but it can't fix line numbers stored in strings (e.g. used in ON ... GOTO with calculated targets).
    After RENUM, run the program — any 'Line does not exist' that pops up is a string-stored number you missed.

Frequently Asked Questions

Can I jump to a line dynamically?

Yes — Locomotive BASIC supports ON I GOTO 100, 200, 300 — picks based on I.
Or use GOTO inside a calculation if you build the program carefully.
But every value that I can take must point to a line that actually exists, or you'll get this error.