Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval: error message from matchN can be very large #3812

Open
rogpeppe opened this issue Mar 12, 2025 · 1 comment
Open

eval: error message from matchN can be very large #3812

rogpeppe opened this issue Mar 12, 2025 · 1 comment
Labels

Comments

@rogpeppe
Copy link
Member

What version of CUE are you using (cue version)?

0cd0a0c05996db4f998e2b90b2a70e37fc7d209c

Does this issue reproduce with the latest stable release?

Yes, similar (v0.12.0)

What did you do?

Run this script with testscript -e CUE_TOKEN=<app token for registry>:

env CUE_CACHE_DIR=$WORK/.cache
env CUE_CONFIG_DIR=$WORK/.config
exec cue login --token $CUE_TOKEN
exec cue vet -c .:schema data.json
-- cue.mod/module.cue --
module: "cuetest.example"
language: {
	version: "v0.11.0"
}
deps: {
	"github.com/cue-tmp/jsonschema-pub/exp3/npmjs/ava@v0": {
		v:       "v0.2.0"
		default: true
	}
	"github.com/cue-tmp/jsonschema-pub/exp3/npmjs/eslint@v0": {
		v:       "v0.2.0"
		default: true
	}
	"github.com/cue-tmp/jsonschema-pub/exp3/npmjs/jscpd@v0": {
		v:       "v0.1.0"
		default: true
	}
	"github.com/cue-tmp/jsonschema-pub/exp3/npmjs/prettier@v0": {
		v:       "v0.1.0"
		default: true
	}
	"github.com/cue-tmp/jsonschema-pub/exp3/npmjs/stylelint@v0": {
		v:       "v0.2.0"
		default: true
	}
	"github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0": {
		v:       "v0.3.0"
		default: true
	}
	"github.com/cue-tmp/jsonschema-pub/exp3/semanticrelease@v0": {
		v:       "v0.1.0"
		default: true
	}
}
-- schema.cue --
package schema

import p "github.com/cue-tmp/jsonschema-pub/exp3/npmpackage"

p.#Schema
-- data.json --
{
	"exports": {
		".": {
			"import": {
				"default": "./dist/esm/index.js",
				"types": "./dist/esm/index.d.ts",
				"types@\u003e=5.0": "./ts-5/index.v5.d.ts"
			},
			"require": {
				"default": "./dist/cjs/index.cjs",
				"types": "./dist/cjs/index.d.cts",
				"types@\u003e=5.0": "./ts-5/index.v5.d.cts"
			}
		},
		"./package.json": "./package.json"
	}
}

What did you expect to see?

A comprehensible failure message.

What did you see instead?

A failure message that's 28000 lines long.

It starts like this:

# test: TestCurationWithRealModules/#00/v2/github.com!cue-tmp!jsonschema-pub!exp3!npmpackage/#Schema/exports-test8 (1.190s)
> env CUE_CACHE_DIR=$WORK/.cache
> env CUE_CONFIG_DIR=$WORK/.config
> exec cue login --token $CUE_TOKEN
[stdout]
Login for registry.cue.works stored in $WORK/.config/logins.json
> exec cue vet -c .:schema data.json
[stderr]
exports: conflicting values =~"^\\./" and {".":{import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}},"./package.json":"./package.json"} (mismatched types string and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:99:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:536:36
    ./data.json:2:13
    ./schema.cue:5:1
exports: conflicting values =~"^\\./" and {default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"} (mismatched types string and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:62
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:522:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:536:36
    ./data.json:4:14
    ./schema.cue:5:1
exports: conflicting values =~"^\\./" and {import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}} (mismatched types string and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:25
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:536:36
    ./data.json:3:8
    ./schema.cue:5:1
exports: conflicting values [...#packageExportsEntry] and {".":{import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}},"./package.json":"./package.json"} (mismatched types list and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:99:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:540:28
    ./data.json:2:13
    ./schema.cue:5:1
exports: conflicting values null and {".":{import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}},"./package.json":"./package.json"} (mismatched types null and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:99:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:536:29
    ./data.json:2:13
    ./schema.cue:5:1
exports: conflicting values null and {default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"} (mismatched types null and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:62
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:522:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:536:29
    ./data.json:4:14
    ./schema.cue:5:1
exports: conflicting values null and {import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}} (mismatched types null and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:25
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:536:29
    ./data.json:3:8
    ./schema.cue:5:1
exports.".": conflicting values [...#packageExportsEntry] and {import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}} (mismatched types list and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:540:28
    ./data.json:3:8
    ./schema.cue:5:1
exports.import: conflicting values [...#packageExportsEntry] and {default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"} (mismatched types list and struct):
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:62
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:522:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:540:28
    ./data.json:4:14
    ./schema.cue:5:1
invalid value {exports:_|_(exports: invalid value {".":{import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}},"./package.json":"./package.json"} (does not satisfy matchN): exports: 0 matched, expected 1 (and 19 more errors)),_schema(github.com/cue-tmp/jsonschema-pub/exp3/npmpackage):{name?:strings.MaxRunes(214) & strings.MinRunes(1) & =~"^(?:(?:@(?:[a-z0-9-*~][a-z0-9-*._~]*)?/[a-z0-9-._~])|[a-z0-9-~])[a-z0-9-._~]*$",version?:string,description?:string,keywords?:[],homepage?:string,bugs?:string | {url?:net.AbsURL(),email?:string},license?:matchN(>=1, (#list){


... 27932 LINES OMITTED


} (does not satisfy matchN): 0 matched, expected >=1:
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:10
    ./data.json:2:2
    ./schema.cue:1:1
exports: 2 errors in empty disjunction::
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:99:16
exports.".": field not allowed:
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:99:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:18:2
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:21:3
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:103:8
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:520:37
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:527:4
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:529:4
    ./data.json:3:8
    ./schema.cue:1:1
    ./schema.cue:5:1
exports: 2 errors in empty disjunction::
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:25
exports.".": invalid value {import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}} (does not satisfy matchN): 0 matched, expected 1:
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:25
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:32
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    ./data.json:3:8
exports.import: invalid value {default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"} (does not satisfy matchN): 0 matched, expected 1:
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:25
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:514:32
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:522:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:46
    ./data.json:4:14
exports.".": invalid value {import:{default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"},require:{default:"./dist/cjs/index.cjs",types:"./dist/cjs/index.d.cts","types@>=5.0":"./ts-5/index.v5.d.cts"}} (does not satisfy matchN): 0 matched, expected 1:
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:35
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:100:11
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:42
    ./data.json:3:8
exports.import: invalid value {default:"./dist/esm/index.js",types:"./dist/esm/index.d.ts","types@>=5.0":"./ts-5/index.v5.d.ts"} (does not satisfy matchN): 0 matched, expected 1:
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:35
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:522:16
    .cache/mod/extract/github.com/cue-tmp/jsonschema-pub/exp3/npmpackage@v0.3.0/schema.cue:532:42
    ./data.json:4:14
[exit status 1]
FAIL: /tmp/curate-fail/testcase-3503003621.txtar:7: unexpected command failure

The failure in v1.12.0 is somewhat similar except the value is printed on a single line that's 345431 characters long.

We should do a better job of figuring out how to print the matchN value in cases like this.

@rogpeppe rogpeppe added NeedsInvestigation Triage Requires triage/attention NeedsFix and removed NeedsInvestigation Triage Requires triage/attention labels Mar 12, 2025
@rogpeppe
Copy link
Member Author

Unfortunately this error does not manifest under evalv3, but leaving here because I believe that matchN prints errors the same in both evaluator versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant