"capnp.lib.capnp.KjException: src/capnp/dynamic.c++:1687: failed: Value type mismatch." when serializing a model that never ran

Hello!
I am trying to just create an HTMPredictionModel and serialize it without running it.
In this case my application crashes withe the message:

“capnp.lib.capnp.KjException: src/capnp/dynamic.c++:1687: failed: Value type mismatch.”

I am serializing it with:

builderProto = model.getSchema().new_message()
model.write(builderProto)

I found out that this happens because at line 844 of knn_anomaly_classifier_region.py" this occurs:
proto.anomalyVectorLength = self._anomalyVectorLength

where self._anomalyVectorLength = None and self._anomalyVectorLength = 0.

Do you know any workaround for this?

Cheers!

Gregorio

1 Like

Hm, we might not have a test case for serializing an empty model. Can you just send one dummy row of data into it before serialization?