cue
cue copied to clipboard
eval: index out of range for "clone" of list
What version of CUE are you using (cue version)?
$ cue version
cue version v0.13.0-alpha.2.0.20250327101324-32d040003e8a
go version go1.24.0
-buildmode exe
-compiler gc
DefaultGODEBUG gotestjsonbuildtext=1,multipathtcp=0,randseednop=0,rsa1024min=0,tlsmlkem=0,x509rsacrt=0,x509usepolicies=0
CGO_ENABLED 1
GOARCH arm64
GOOS linux
GOARM64 v8.0
vcs git
vcs.revision 32d040003e8a43b96d667d1ec2a2a02957853577
vcs.time 2025-03-27T10:13:24Z
vcs.modified false
cue.lang.version v0.13.0
Does this issue reproduce with the latest release?
Yes
What did you do?
exec cue export x.cue
cmp stdout stdout.golden
-- x.cue --
_reduce: {
_defaults: [...]
_layers: [for i, d in _defaults {d}]
res: _layers[0]
}
top: _reduce & {
_defaults: [""]
}
-- stdout.golden --
{
"top": {
"res": ""
}
}
What did you expect to see?
Passing test.
What did you see instead?
> exec cue export x.cue
[stderr]
_reduce.res: index out of range [0] with length 0:
./x.cue:4:15
[exit status 1]
FAIL: repro.txtar:1: unexpected command failure
Still happens as of v0.15.0. My immediate thought was to use an alias, as follows, but it fails the same:
_reduce: this={
_defaults: [...]
_layers: [for i, d in this._defaults {d}]
res: _layers[0]
}