protobufjs 7.5.5 and 8.0.1 has a bug where decode_setup(), the lazy-initialization wrapper for .decode() only forwards (reader, length) but not the third e (end-tag) argument. This means on the first decode call for any type, proto2 group end markers (wire type 4) aren't recognized, causing an "invalid wire type 4" error.
There is a workaround, pre-calling setup() on every type avoids hitting decode_setup at runtime.
function setupAllTypes(ns: protobufjs.NamespaceBase) {
if (ns instanceof protobufjs.Type) {
ns.setup();
}
for (const nested of ns.nestedArray) {
if (nested instanceof protobufjs.Namespace) {
setupAllTypes(nested);
}
}
}
protobufjs 7.5.5 and 8.0.1 has a bug where decode_setup(), the lazy-initialization wrapper for .decode() only forwards (reader, length) but not the third e (end-tag) argument. This means on the first decode call for any type, proto2 group end markers (wire type 4) aren't recognized, causing an "invalid wire type 4" error.
There is a workaround, pre-calling setup() on every type avoids hitting decode_setup at runtime.