>> As can be seen, there are no bar lines available in the first
>> staff, which are needed for the bar number engraver to vertically
>> position a bar number.
>
> So ideally the bar number engraver could be written to not engrave a
> bar number if there is no barline?
This could be a solution, yes. If I understand the issue correctly,
however, the bar number engraver uses a default value instead because
it cannot derive 'pure heights' (i.e., vertical, possibly preliminary
positions relative to the current staff calculated before doing the
actual vertical layout).
>> Of course, the error message is cryptic, and my interpretation
>> might just be an educated guess – but I believe that a error
>> message is OK for this situation.
>
> I'm hoping so, but although there is an ly:expect-warning there
> doesn't appear to be an ly:expect-error ...
Well, yes. A 'programming error' is always bad since it points to a
problem that a normal user shouldn't see. AFAICS, however, it's just
a warning in this case, and LilyPond returns as being successful.
Werner