Skip to content
Latchkey

Octave "parse error" in CI

Octave could not parse the file. The message points at the line and column. In CI this is frequently MATLAB-only syntax that Octave does not accept, or a missing end/endfunction that a permissive local setup tolerated.

What this error means

A run stops before executing with "parse error:" and a caret pointing at the offending token, naming the file and line.

Octave
parse error:

  syntax error

>>> x = data.^2
              ^

Common causes

MATLAB-only syntax Octave rejects

Constructs like unsupported operators, string literals, or certain block forms parse in MATLAB but not in this Octave version.

A missing end or keyword

An unmatched if/for/function block, or a missing endfunction, produces a parse error at end of file.

How to fix it

Use Octave-compatible syntax

  1. Read the line and column in the parse error.
  2. Replace MATLAB-only syntax with an Octave-supported form.
  3. Balance every if/for/while/function with its end.

Lint before running

Parse-check each file so syntax errors fail fast with a clear location.

Terminal
octave-cli --eval "source('src/report.m')"

How to prevent it

  • Write to the common MATLAB/Octave syntax subset when both must run.
  • Balance block keywords with explicit end forms.
  • Parse-check files in CI before executing them.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →