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
- 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.
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
endforms. - Parse-check files in CI before executing them.
Related guides
Octave MATLAB incompatibility (function not in Octave) in CIFix code that works in MATLAB but fails in Octave CI - a function or syntax exists in MATLAB but not in GNU O…
Octave "error: 'X' undefined" in CIFix Octave "error: 'X' undefined" in CI - the name is not on the Octave path (addpath missing), belongs to an…
Octave mkoctfile compiler / .oct build error in CIFix Octave mkoctfile ".oct" build failures in CI - compiling an oct-file needs a C++ compiler and Octave dev…