You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Some cue errors are not caught before running #493
One big selling point of Cue is that you can catch many errors in your configuration before applying it. However, certain errors which should be caught before running (or at least feel like they should be caught), are not.
So far I have identified one category of errors which is not caught by Cue before execution:
References to a non-existing definition in an imported package
For example, I expect this snippet to fail before execution, but it does not:
import (
“strings” // Package name does not matter. Builtin or external package doesn’t matter.
)
// #Nope field does not exist in the package
foo: strings.#Nope
In summary, references to non-existing fields in another package are not considered an error at build time, but will in fact resolve to an error when queried at run time.
failed to load plan: client.filesystem.".".read.contents: undefined field: FS
But what you see is:
failed to load plan: "client.filesystem.\".\".read" is not set
The reason is that validation is being done from top down. First on client, then client: filesystem, etc... When it reaches client: filesystem: ".": read it's not concrete because the read: contents field is a disjunction that isn't resolved due to the undefined field (typo).
In fact, if you look closely into the incomplete cause disjunction error, you can see the error buried in there:
ERROR system | failed to load plan: "client.filesystem.\".\".read" is not set
actions.test.undefinedAction.input: unresolved disjunction
{contents:_|_(client.filesystem.".".read.contents: incomplete cause disjunction),
$dagger:{task:{_name(dagger.io/dagger):"ClientFilesystemRead"}},path:*"." | string} |
{contents:_|_(client.filesystem.".".read.contents: undefined field: FS),
$dagger:{task:{_name(dagger.io/dagger):"ClientFilesystemRead"}},path:*"." | string} (type struct)
I think we need to prioritize at least undefined field errors since they're clearly a cause for other errors upper in the tree, and it's easier for the user to get to that root cause.
Activity
shykes commentedon May 25, 2021
Copying @aluzzardi @mpvl @myitcv . We have discussed this one before - I’m just documenting it to make sure we don’t forget it.
myitcv commentedon May 25, 2021
Here is a link to the CUE issue tracking this cue-lang/cue#629
aluzzardi commentedon Feb 2, 2022
Moved to cue-lang/cue#629
aluzzardi commentedon Feb 2, 2022
Moving this to
0.2.xsince there's not much we can do but wait for an upstream fix.19 remaining items
mircubed commentedon Jun 28, 2022
based on this comment from @shykes , @aluzzardi and @helderco please check if this needs to be re-opened?
discord comment -https://discord.com/channels/707636530424053791/796905486145683506/989285536420216872
helderco commentedon Jul 5, 2022
The issue from that comment is the error you get when you mistype the following:
The expected error would be:
failed to load plan: client.filesystem.".".read.contents: undefined field: FSBut what you see is:
failed to load plan: "client.filesystem.\".\".read" is not setThe reason is that validation is being done from top down. First on
client, thenclient: filesystem, etc... When it reachesclient: filesystem: ".": readit's not concrete because theread: contentsfield is a disjunction that isn't resolved due to the undefined field (typo).In fact, if you look closely into the incomplete cause disjunction error, you can see the error buried in there:
ERROR system | failed to load plan: "client.filesystem.\".\".read" is not set actions.test.undefinedAction.input: unresolved disjunction {contents:_|_(client.filesystem.".".read.contents: incomplete cause disjunction), $dagger:{task:{_name(dagger.io/dagger):"ClientFilesystemRead"}},path:*"." | string} | {contents:_|_(client.filesystem.".".read.contents: undefined field: FS), $dagger:{task:{_name(dagger.io/dagger):"ClientFilesystemRead"}},path:*"." | string} (type struct)I think we need to prioritize at least undefined field errors since they're clearly a cause for other errors upper in the tree, and it's easier for the user to get to that root cause.