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

opa eval panics when usinginput() #4761

Closed
srenatus opened this issue Jun 9, 2022 · 2 comments
Closed

opa eval panics when usinginput() #4761

srenatus opened this issue Jun 9, 2022 · 2 comments
Labels

Comments

@srenatus
Copy link
Contributor

srenatus commented Jun 9, 2022

open-policy-agent/opa % opa eval '[input() | input := 1]'
panic: interface conversion: ast.Value is ast.Var, not ast.Ref

goroutine 1 [running]:
github.com/open-policy-agent/opa/ast.(*Expr).Operator(...)
        /Users/stephan/Sources/open-policy-agent/opa/ast/policy.go:1178
github.com/open-policy-agent/opa/ast.checkUndefinedFuncs.func1(0xc000349080)
        /Users/stephan/Sources/open-policy-agent/opa/ast/compile.go:881 +0x689
github.com/open-policy-agent/opa/ast.WalkExprs.func1({0x5727500?, 0xc000349080?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:213 +0x36
github.com/open-policy-agent/opa/ast.(*GenericVisitor).Walk(0xc0007fe1f8, {0x5727500?, 0xc000349080?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:278 +0x5c
github.com/open-policy-agent/opa/ast.(*GenericVisitor).Walk(0xc0007fe1f8, {0x56ed420?, 0xc00026aae0?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:319 +0xac7
github.com/open-policy-agent/opa/ast.(*GenericVisitor).Walk(0xc0007fe1f8, {0x56a5c80?, 0xc00025b3a0?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:361 +0x80c
github.com/open-policy-agent/opa/ast.(*GenericVisitor).Walk(0xc0007fe1f8, {0x56ea840?, 0xc00026aa50?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:341 +0x545
github.com/open-policy-agent/opa/ast.(*GenericVisitor).Walk(0xc0007fe1f8, {0x5727500?, 0xc000348fc0?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:331 +0xb85
github.com/open-policy-agent/opa/ast.(*GenericVisitor).Walk(0xc0007fe1f8, {0x56ed420?, 0xc00026aac8?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:319 +0xac7
github.com/open-policy-agent/opa/ast.WalkExprs({0x56ed420?, 0xc00026aac8?}, 0x63b0a40?)
        /Users/stephan/Sources/open-policy-agent/opa/ast/visit.go:217 +0x58
github.com/open-policy-agent/opa/ast.checkUndefinedFuncs(0xc00011a738?, {0x56ed420?, 0xc00026aac8?}, 0x1?, 0xc00026a8d0?)
        /Users/stephan/Sources/open-policy-agent/opa/ast/compile.go:877 +0x78
github.com/open-policy-agent/opa/ast.(*queryCompiler).checkUndefinedFuncs(0xc000348f00, 0xc00025b380?, {0xc00011a738, 0x1, 0x1})
        /Users/stephan/Sources/open-policy-agent/opa/ast/compile.go:2476 +0x7e
github.com/open-policy-agent/opa/ast.(*queryCompiler).runStage(0x55e6720?, {0x577fe57?, 0x575dafe?}, 0x11?, {0xc00011a738?, 0x90?, 0x6d175b8?}, 0x90?)
        /Users/stephan/Sources/open-policy-agent/opa/ast/compile.go:2312 +0x173
github.com/open-policy-agent/opa/ast.(*queryCompiler).Compile(0xc000348f00, {0xc00011a430, 0x1, 0x5762f57?})
        /Users/stephan/Sources/open-policy-agent/opa/ast/compile.go:2356 +0x6bb
github.com/open-policy-agent/opa/rego.(*Rego).compileQuery(0xc00022a900, {0xc00011a430, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0?, 0xc00011a430?}, {0xc0007feaa8, ...})
        /Users/stephan/Sources/open-policy-agent/opa/rego/rego.go:1886 +0x244
github.com/open-policy-agent/opa/rego.(*Rego).compileAndCacheQuery(0xc00022a900, 0xc000332c00?, {0xc00011a430, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x5ab4e48, 0xc000332c00}, ...)
        /Users/stephan/Sources/open-policy-agent/opa/rego/rego.go:1830 +0x265
github.com/open-policy-agent/opa/rego.(*Rego).prepare(0xc00022a900, {0x5ab0d20, 0xc0000360f0}, 0x0?, {0xc0007feaa8, 0x1, 0x1})
        /Users/stephan/Sources/open-policy-agent/opa/rego/rego.go:1625 +0x472
github.com/open-policy-agent/opa/rego.(*Rego).PrepareForEval(0xc00022a900, {0x5ab0d20, 0xc0000360f0}, {0x0, 0x0, 0x320004011387?})
        /Users/stephan/Sources/open-policy-agent/opa/rego/rego.go:1471 +0x518
github.com/open-policy-agent/opa/cmd.evalOnce({0x5ab0d20, 0xc0000360f0}, 0xc0000003c0)
        /Users/stephan/Sources/open-policy-agent/opa/cmd/eval.go:400 +0x272
github.com/open-policy-agent/opa/cmd.eval({_, _, _}, {0xc000239260, 0x0, 0x0, {0xc0000d7000, 0x1, 0x1}, {0x63ebd00, ...}, ...}, ...)
        /Users/stephan/Sources/open-policy-agent/opa/cmd/eval.go:328 +0x3ea
github.com/open-policy-agent/opa/cmd.init.5.func2(0xc0001ae500?, {0xc0000d7320?, 0x1?, 0x1?})
        /Users/stephan/Sources/open-policy-agent/opa/cmd/eval.go:253 +0x78
github.com/spf13/cobra.(*Command).execute(0xc0001ae500, {0xc0000d72f0, 0x1, 0x1})
        /Users/stephan/Sources/open-policy-agent/opa/vendor/github.com/spf13/cobra/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x6394fc0)
        /Users/stephan/Sources/open-policy-agent/opa/vendor/github.com/spf13/cobra/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/stephan/Sources/open-policy-agent/opa/vendor/github.com/spf13/cobra/command.go:902
main.main()
        /Users/stephan/Sources/open-policy-agent/opa/main.go:15 +0x25
@johanfylling
Copy link
Contributor

Duplicate of issue #4762.

@srenatus
Copy link
Contributor Author

srenatus commented Jun 9, 2022

Yours is better. Thanks!

@srenatus srenatus closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2022
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

2 participants