Skip to content
Latchkey

Octave "error: index out of bound" in CI

Octave indexed past the end of an array. In CI the array is often smaller than locally because a different fixture, an empty result, or a shorter dataset changed its length.

What this error means

A run stops with "error: data(4): out of bound 3 (dimensions are 1x3)" at a subscript that assumed a fixed size.

Octave
error: data(4): out of bound 3 (dimensions are 1x3)
error: called from
    report at line 6 column 5

Common causes

The array is shorter than the code assumes

A hardcoded index fails when CI produced fewer elements from different input.

An empty result from an earlier step

A filter or query returned empty on the runner, so any positive index is out of bounds.

How to fix it

Guard against the real length

  1. Check numel(data) before indexing.
  2. Handle the empty or short case explicitly.
  3. Reproduce with the CI fixture to confirm the size difference.
report.m
assert(numel(data) >= 4, 'expected >=4 samples, got %d', numel(data));
v = data(4);

Align fixtures between local and CI

Use identical input data in both places so array sizes match.

How to prevent it

  • Validate array lengths before fixed-index access.
  • Handle empty results explicitly.
  • Keep fixtures identical across local and CI runs.

Related guides

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