aspect-build/aspect-cli

[Bug]: go panic when running configure on js/ts project (inside parseTsConfigJSON)

matthewjh opened this issue · 7 comments

What happened?

When running aspect configure in my org's source tree, the following error results:

bazel configure
Updating BUILD files for javascript
panic: runtime error: slice bounds out of range [:10] with length 0 [recovered]
panic: interface conversion: interface {} is runtime.boundsError, not *ast.item

goroutine 1 [running]:
github.com/msolo/jsonr/ast.(*lexer).yield.func1()
external/com_github_msolo_jsonr/ast/lex.go:72 +0x80
panic({0x101a2df20, 0x14001124120})
GOROOT/src/runtime/panic.go:884 +0x1f4
github.com/msolo/jsonr/ast.lexValue(0x1400127c780)
external/com_github_msolo_jsonr/ast/lex-jsonr.go:77 +0x20c
github.com/msolo/jsonr/ast.lexElement(0x40?)
external/com_github_msolo_jsonr/ast/lex-jsonr.go:52 +0x28
github.com/msolo/jsonr/ast.lexStream(0x1400127c780)
external/com_github_msolo_jsonr/ast/lex-jsonr.go:28 +0x3c
github.com/msolo/jsonr/ast.(*lexer).yield(0x1400127c780)
external/com_github_msolo_jsonr/ast/lex.go:78 +0x144
github.com/msolo/jsonr/ast.(*astParser).next(0x14000f714b0)
external/com_github_msolo_jsonr/ast/ast.go:132 +0xc0
github.com/msolo/jsonr/ast.(*astParser).Parse(0x14000f714b0, {0x0, 0x0})
external/com_github_msolo_jsonr/ast/ast.go:146 +0x130
github.com/msolo/jsonr/ast.Parse(...)
external/com_github_msolo_jsonr/ast/ast.go:117
github.com/msolo/jsonr.Convert2Json({0x0?, 0x1015b1a0c?})
external/com_github_msolo_jsonr/jsonr.go:60 +0x38
github.com/msolo/jsonr.Unmarshal({0x1400011fc00?, 0x100e2b9c8?, 0x100da2f50?}, {0x1018c8280, 0x14001a9c3c0})
external/com_github_msolo_jsonr/jsonr.go:19 +0x38
aspect.build/cli/gazelle/js/typescript.parseTsConfigJSON(0x14000edf6c0?, {0x140006846d8, 0x14}, {0x1400115b660, 0x17}, {0x1400011fc00, 0x0, 0x200})
gazelle/js/typescript/tsconfig.go:68 +0x6c
aspect.build/cli/gazelle/js/typescript.parseTsConfigJSONFile(0x14000680248, {0x140006846d8, 0x14}, {0x1400115b660, 0x17}, {0x1400112410b, 0x12})
gazelle/js/typescript/tsconfig.go:61 +0xd4
aspect.build/cli/gazelle/js/typescript.parseTsConfigJSON(0x14000edf500?, {0x140006846d8, 0x14}, {0x1400115b320, 0x19}, {0x14001041e00, 0x29, 0x200})
gazelle/js/typescript/tsconfig.go:74 +0x114
aspect.build/cli/gazelle/js/typescript.parseTsConfigJSONFile(0x14000680248, {0x140006846d8, 0x14}, {0x1400115b320, 0x19}, {0x10167c69b, 0xd})
gazelle/js/typescript/tsconfig.go:61 +0xd4
aspect.build/cli/gazelle/js/typescript.(*TsWorkspace).AddTsConfigFile(0x14000680240, {0x140006846d8?, 0x10166efe8?}, {0x1400115b320, 0x19}, {0x10167c69b, 0xd})
gazelle/js/typescript/config.go:30 +0x40
aspect.build/cli/gazelle/js.(*TypeScript).readConfigurations(0x140006164b0, 0x140014ebb80, {0x1400115b320, 0x19})
gazelle/js/configure.go:114 +0x1bc
aspect.build/cli/gazelle/js.(*TypeScript).Configure(0x1021ae2f0?, 0x140014ebb80, {0x1400115b320, 0x19}, 0x140005288c0)
gazelle/js/configure.go:79 +0x1ac
github.com/bazelbuild/bazel-gazelle/walk.configure({0x14000616500, 0x5, 0x19?}, 0x140014e3590?, 0x140014eb760?, {0x1400115b320, 0x19}, 0x140005288c0)
external/bazel_gazelle/walk/walk.go:292 +0x2c4
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x140014eb760, {0x140014e3590, 0x2e}, {0x1400115b320, 0x19}, 0x1)
external/bazel_gazelle/walk/walk.go:147 +0x188
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x140014eb4a0, {0x140014e2cf0, 0x2c}, {0x140002fde60, 0x17}, 0x1)
external/bazel_gazelle/walk/walk.go:172 +0x628
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x140013b2210, {0x140014e2ab0, 0x27}, {0x14000565f50, 0x12}, 0x1)
external/bazel_gazelle/walk/walk.go:172 +0x628
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x1400025cb00, {0x14000ab3320, 0x1a}, {0x1400069eef6, 0x5}, 0x1)
external/bazel_gazelle/walk/walk.go:172 +0x628
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x1400025cb00, {0x140006846d8, 0x14}, {0x0, 0x0}, 0x0)
external/bazel_gazelle/walk/walk.go:172 +0x628
github.com/bazelbuild/bazel-gazelle/walk.Walk(0x1400025cb00, {0x14000616500?, 0x5, 0x5}, {0x14000e10790, 0x1, 0x1}, 0x0, 0x14000e32e00)
external/bazel_gazelle/walk/walk.go:182 +0x1d8
aspect.build/cli/pkg/aspect/configure.runFixUpdate({0x1400004407c, 0x14}, {0x14000e33838?, 0x1, 0x20}, 0x1?, {0x1021ae2f0, 0x0, 0x0})
pkg/aspect/configure/fix-update.go:281 +0x8d4
aspect.build/cli/pkg/aspect/configure.(*Configure).Run(0x140003592c0, {0x0?, 0x0?}, 0x0?, {0x1021ae2f0, 0x0, 0x0})
pkg/aspect/configure/configure.go:100 +0x69c
aspect.build/cli/pkg/aspect/root/flags.FlagsInterceptor.func1({0x101aa21f0, 0x14000042068}, 0x14000e16f00, {0x1021ae2f0?, 0x18?, 0x1019b9740?}, 0x14000e10290)
pkg/aspect/root/flags/interceptor.go:106 +0x1b4
aspect.build/cli/pkg/interceptors.Run.func1.1({0x101aa21f0?, 0x14000042068?}, 0x0?, {0x1021ae2f0?, 0x0?, 0x0?})
pkg/interceptors/run.go:45 +0x34
aspect.build/cli/pkg/interceptors.Run.func1(0x14000e16f00, {0x1021ae2f0, 0x0, 0x0})
pkg/interceptors/run.go:48 +0xf4
github.com/spf13/cobra.(*Command).execute(0x14000e16f00, {0x1021ae2f0, 0x0, 0x0})
external/com_github_spf13_cobra/command.go:916 +0x5c4
github.com/spf13/cobra.(*Command).ExecuteC(0x14000018300)
external/com_github_spf13_cobra/command.go:1040 +0x338
github.com/spf13/cobra.(*Command).Execute(...)
external/com_github_spf13_cobra/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(0x14000358270?, {0x101aa21f0?, 0x14000042068?})
external/com_github_spf13_cobra/command.go:961 +0x4c
main.command({0x101aa5630, 0x140001c8330}, {{0x101a9afe0, 0x1400000e010}, {0x101a9b040, 0x1400000e018}, {0x101a9b040, 0x1400000e020}})
cmd/aspect/main.go:96 +0x1b8
main.main()
cmd/aspect/main.go:71 +0x2e8

Version

Development (host) and target OS/architectures:

Output of bazel --version:
aspect 5.3.4
w/ bazel 6.2.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:
JS & TS

How to reproduce

No response

Any other information?

No response

Would you be able to post your tsconfig? Does it have something interesting in it such as comments or odd syntax?

We have about a hundred tsconfigs so it's a little hard to know where to start. No comments or odd syntax, though I'm not sure what would even constitute odd syntax in vanilla JSON.

Is there a verbose or debug mode so I can know which folder or file it is processing right before it blows up?