I don't see how this code can 'just fail'  A cube with no 'Z' like coordinates is a reasonable cube, I think.  I don't see where we or anyone else has put forward that it is not.

I think the question is how to encode a Cube which has no 'z' like coordinate in GRIB2.

I support Patrick's suggestion to consult other users on this, the ECMWF seem as good a candidate as any.

The use of the 'missing' | 255 seems valid to me, although I haven't seen it in use much.  I am interested as to whether the use of 1 as a default is common practice.

What does the 2nd fixed surface get encoded as if it is not in use?