function-schemata code can be found at https://gerrit.wikimedia.org/g/mediawiki/services/function-schemata
javascript/src/errorFormatter.js line 76 (and other places).
As a test, try validating this ZObject as a normal-form Z7. This validation should 1) produce a validationStatus with Z5s attached and 2) not throw an exception.
{ Z1K1: { Z1K1: 'Z9', Z9K1: 'Z7' }, Z7K1: { Z8K4: { Z10K1: { Z14K3: { Z16K1: { Z61K1: { Z6K1: 'javascript' } } } } }, Z8K5: { Z1K1: 'Z9', Z9K1: 'Z1000' } } }