I have encountered a misleading error message that kept me in debugging for a few minutes until I actually realized what's the problem.
I have simplified it down to this:
The problem is that I'm decoding a .bar keyed value into temporary variable tmpBar that I'm later using to derive a real bar value. And I used foo instance variable to do that. However the error message tells me that bar was actually captured by a closure before being initialised. To fix I just had to do a local copy of instance variable that I was using inside map closure.
Please find the compressed playground attached.