Thanks Congxian. From what I've read, it seems that using the keyed state in `snapshotState` is incorrect...what confuses me is that if I do something like this
``` override def snapshotState(context: FunctionSnapshotContext): Unit = { if (models.nonEmpty) { modelsBytes.clear() // This raises an exception when there is no active key set for ((k, model) <- models) { modelsBytes.put(k, model.toBytes(v)) } } } ``` Then, when there is data (`models` is populated within `processElement1`), the `clear` and subsequent calls to `put` work just fine. This seems like a bug to me, as others have pointed out in this somehow extended question posted in stackoverflow: https://stackoverflow.com/questions/59123188/state-handling-on-keyedcoprocessfunction-serving-ml-models Do you think the fact that `clear` works within `snapshotState` under certain circumstances is indeed a bug? -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/