mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Forcing values with toMap in dependency loop situations can emit null values from VmObject.iterateAlreadyForcedMemberValues
#337
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sin-ack on GitHub (Aug 20, 2025).
Reproduced in Pkl 0.29.0.
I don't really have a reproducer for this, as the failure happens in an internal codebase which I am not allowed to share and I haven't been able to create an independent reproduction that exhibits the error. This is an approximation of how the code looks (but does not reproduce the error):
When I evaluate
definition.pklin the internal codebase, I get the following Pkl error (stack trace redacted/modified to fit the code example):I dug through the VM code a bit, and it seems at this particular line
nullis returned:3f2f0c3a2b/pkl-core/src/main/java/org/pkl/core/runtime/VmObject.java (L130-L132)Which then results in a Java null which is un
trace()able. Indeed, if I enable assertions injpkl, theassertbelow it triggers.I'm not sure what exactly is causing forcing to fail like this, but presumably Pkl should either outright reject the
toMapbecause of the dependency loop (definition -> DockerNetworkTask -> meta -> definition) or allow partial forcing.@sin-ack commented on GitHub (Aug 20, 2025):
(FWIW, substituting
Mapping.toMap().values.filterwithMapping.fold()works as expected, so it'stoMap's forcing in particular that's messing up somewhere.)@bioball commented on GitHub (Aug 26, 2025):
Thanks for the bug report. It's a little hard to figure out the root cause without a reproducer, so, definitely let us know if you find one.