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.
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
- Read the line and column in the parse error.
- Replace MATLAB-only syntax with an Octave-supported form.
- Balance every
if/for/while/functionwith itsend.
Lint before running
Parse-check each file so syntax errors fail fast with a clear location.
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
endforms. - Parse-check files in CI before executing them.