Message contains out of bound struct pointer when trying to access the elements of Detections3Proto

I am trying to write a custom ros bridge for an application. In the ros bridge, I have a RX proto of type Detections3Proto. When i try to access this particular proto, half of its contents are being accessed properly while the other half it throwns an error ,
terminate called after throwing an instance of ‘kj::ExceptionImpl’
what(): capnp/layout.c++:2174: failed: expected boundsCheck(segment, ptr, ref->structRef.wordSize()); Message contained out-of-bounds struct pointer.
stack: 7f47c2c799a7 561d07716ef7 561d0778f505 561d076c943b 7f47c3e696de 7f47c413c6da 7f47c38c471e

The way I am receinging this proto and reading it can be seen from the image. Can anyone please help me figure out what exactly this error means as I have checked multiple times to be sure that the particular pointer is not dereferenced or out of scope before its read after accessed.

Note: This problem most likely looks like a shallow copy problem and i believe the solution for it to be a deep copy by manually creating a new resource of same type as the Reader and then perform deep copy but I am not sure off this.

Thank you.

Please post it here incase you find a solution as I have been facing the same issue. Thanks