AF08

A path contained a numeric segment that is not a non-negative integer.

In development this reads:

Path segments must be non-negative integers when numeric; got -1

The production message appends the offending value after the code.

What happened

Numeric segments address array positions, so -1, 1.5, and NaN have no target. The path canonicalizer rejects them at the boundary, before any read or write runs against the form tree.

How to fix it

Pass a real index. Computed positions are the usual source; clamp or guard the arithmetic that produced the value before it enters the path:

form.setValue(['items', items.length - 1, 'name'], 'last')

guards items.length > 0, or the computed index is -1.

setValue patterns covers both path forms, dotted and segment-tuple, and when to reach for each.