cue
cue copied to clipboard
evalv3: export via api error regression with the new evaluator
What version of CUE are you using (cue version)?
$ cue version
cue version v0.9.0-alpha.5
go version go1.22.3
-buildmode exe
-compiler gc
-trimpath true
CGO_ENABLED 0
GOARCH amd64
GOOS linux
GOAMD64 v1
cue.lang.version v0.9.0
Does this issue reproduce with the latest stable release?
no
What did you do?
attachment: issue.txtar.txt
testscript issue.txtar
What did you expect to see?
PASS
What did you see instead?
failing execution of go run
[...] adding field redis not allowed as field set was already referenced
updated txtar that just uses cue:
issue2.txtar.txt
Just realized this is an evaluator (default vs. v3) issue, not cue cmd vs. cue api. Removing cuecontext.EvaluatorVersion(cuecontext.EvalV3) in the go code makes this work. Please feel free to close this issue unless it's still valuable as evaluator issue.
The issue is still valuable - we want to be aware of any unexpected errors or regressions with the new evaluator. Thanks!
I'm facing the same error message adding field <x> not allowed as field set was already referenced in my application, for a CUE payload that is evaluating fine when using cue v0.11.0-alpha.3 + old evaluator, but fails with CUE_EXPERIMENT=evalv3.
I narrowed down to the smallest reproducer samples I could come up with:
$ cue version
cue version v0.11.0-alpha.3
go version go1.23.2
-buildmode exe
-compiler gc
-trimpath true
CGO_ENABLED 0
GOARCH amd64
GOOS windows
GOAMD64 v1
cue.lang.version v0.11.0
$ cat file.cue
input: [ "Value" ]
output: {...}
for name in input {
output: "\(name)": true
}
for name, v in output {
// do nothing
}
$ cue eval file.cue
output: adding field Value not allowed as field set was already referenced:
.\file.cue:4:21
Also when tuning a bit this sample to remove the string interpolation, I'm getting instead an unexpected empty result with eval and a cyclic error with eval -c:
$ cat file2.cue
input: [0]
output: {...}
for i in input {
output: Value: i
}
for name, v in output {
// do nothing
}
$ cue eval file2.cue
$ cue eval -c file2.cue
output.Value: cyclic reference to field Value:
.\file2.cue:3:1