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

[library] panic when exported function contains a syntax error #156

Closed
cppforlife opened this issue Jun 18, 2020 · 3 comments
Closed

[library] panic when exported function contains a syntax error #156

cppforlife opened this issue Jun 18, 2020 · 3 comments
Assignees
Labels
bug This issue describes a defect or unexpected behavior carvel triage This issue has not yet been triaged for relevance in progress Work has begun by a community member or a maintainer; this issue may be included in a future release

Comments

@cppforlife
Copy link
Contributor

https://get-ytt.io/#gist:https://gist.github.com/cppforlife/b9d54ff11278a4e1cfe5d2c8c96f62ca

error: panic: Expected to find compiled template: Expected to find '_ytt_lib/app/config.lib.yml' compiled template

goroutine 1 [running]:
github.com/k14s/ytt/pkg/template.CompiledTemplateMultiError.buildPos(0x0, 0x0, 0x0, 0xb11560, 0xc000092a00, 0xc000132940, 0x1a00000006, 0x0, 0x0, 0x0, ...)
	github.com/k14s/ytt@/pkg/template/compiled_template_error.go:157 +0x467
github.com/k14s/ytt/pkg/template.CompiledTemplateMultiError.buildEvalErr(0x0, 0x0, 0x0, 0xb11560, 0xc000092a00, 0xc00013a9f0, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/k14s/ytt@/pkg/template/compiled_template_error.go:140 +0x105
github.com/k14s/ytt/pkg/template.NewCompiledTemplateMultiError(0xb0d4c0, 0xc00013a9f0, 0xb11560, 0xc000092a00, 0x0, 0x0)
	github.com/k14s/ytt@/pkg/template/compiled_template_error.go:53 +0x7e4
github.com/k14s/ytt/pkg/template.(*CompiledTemplate).Eval(0xc000064b40, 0xc000092cd0, 0xb11560, 0xc000092a00, 0xc000092640, 0xc000092cd0, 0xc0000fb740, 0x20, 0x8fcda0)
	github.com/k14s/ytt@/pkg/template/compiled_template.go:120 +0x70e
github.com/k14s/ytt/pkg/workspace.(*TemplateLoader).EvalYAML(0xc000092a00, 0xc000092690, 0xc000092690, 0xc000092640, 0xc00000e1a8, 0x1, 0x1, 0xc00009f650)
	github.com/k14s/ytt@/pkg/workspace/template_loader.go:171 +0x686
github.com/k14s/ytt/pkg/workspace.(*LibraryLoader).eval(0xc00014ba68, 0xc00001f040, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/k14s/ytt@/pkg/workspace/library_loader.go:140 +0xac7
github.com/k14s/ytt/pkg/workspace.(*LibraryLoader).Eval(0xc00014ba68, 0xc00001f040, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	github.com/k14s/ytt@/pkg/workspace/library_loader.go:91 +0x77
github.com/k14s/ytt/pkg/cmd/template.(*TemplateOptions).RunWithFiles(0xc000097540, 0xc0000317c0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/k14s/ytt@/pkg/cmd/template/cmd.go:132 +0x4b5
github.com/k14s/ytt/pkg/cmd/template.(*TemplateOptions).Run(0xc000097540, 0x0, 0x0)
	github.com/k14s/ytt@/pkg/cmd/template/cmd.go:85 +0x28b
github.com/k14s/ytt/pkg/cmd/template.NewCmd.func1(0xc0000b6dc0, 0xc0000fae10, 0x0, 0x3, 0x0, 0x0)
	github.com/k14s/ytt@/pkg/cmd/template/cmd.go:53 +0x2a
github.com/cppforlife/cobrautil.WrapRunEForCmd.func1.1(0xc0000b6dc0, 0xc0000fae10, 0x0, 0x3, 0x0, 0x0)
...
@cppforlife cppforlife added the bug This issue describes a defect or unexpected behavior label Jun 18, 2020
@ewrenn8 ewrenn8 added the in progress Work has begun by a community member or a maintainer; this issue may be included in a future release label Jul 16, 2020
@cppforlife cppforlife removed the in progress Work has begun by a community member or a maintainer; this issue may be included in a future release label Jul 20, 2020
@pivotaljohn
Copy link
Contributor

@GrahamDumpleton's report ☝🏻 contains additional valuable nuance.

@pivotaljohn
Copy link
Contributor

Diagnosis (in progress):

  • The CompiledTemplate (or more precisely, the CompiledTemplateMultiError sub-component) assumes that whatever source of Starlark that has errored out is available as a template to the TemplateLoader that was driving the evaluation.
    • CompiledTemplateMultiError is attempting to build up the error message including filename, position, and source text of the implicated line of Starlark source.
  • In certain cases — like when the erroring Starlark is code exported from another library — that Starlark source (referred to internally as a "template") was not registered as a "template" with the TemplateLoader.
    • this will also be the case for any generated Starlark source.

(in progress; will update this comment as a summary as more details are discovered.)

@pivotaljohn pivotaljohn self-assigned this Jun 17, 2022
@pivotaljohn pivotaljohn added the in progress Work has begun by a community member or a maintainer; this issue may be included in a future release label Jun 17, 2022
@pivotaljohn
Copy link
Contributor

Published in v0.42.0.

@github-actions github-actions bot added the carvel triage This issue has not yet been triaged for relevance label Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel triage This issue has not yet been triaged for relevance in progress Work has begun by a community member or a maintainer; this issue may be included in a future release
Projects
None yet
Development

No branches or pull requests

3 participants