Resource iteration error

We have a case on testnet with some specific accounts. We are iterating over stored objects of the user with the function forEachStored() and forEachPublic() and we get an error on one resource:

39f0e47b8acdcbc6.FLOAT (on testnet)

You can try it by iterating over the 0x6557f63c9ed53101 (on testnet) to reproduce the error.

Is there any fix or workaround to apply in the cases that the user has some old broken objects?

1 Like

Can you give more context on what you want to do here. The problem is that the path for floats for some users it will be correct, but for others it will not be.

If you control this account you can remove the old link and that will fix it. If not it is really hard to solve for some use cases.

Hi bjartek

Thanks for your response. We have some resources stored using the timestamp as part of the name. That is why we need to iterate over the resources. We do not control the accounts where this issue happens, but maybe we can suggest them to execute a transaction to remove the link.

By the way, do you have any information about this FLOAT resource? Is it no longer used?

The storage iteration is supposed to skip any broken values (https://github.com/onflow/cadence/pull/2202). But seems like there is an issue in the implementation, where it still causing a panic, rather than skipping. I will have a look and try to fix it at the Cadence level.

1 Like

Hi Supun

Thanks for your response and for sharing this information. Please let me know if you can fix it.