Panic error when ' opa eval --partial --unknowns ... '

55 views Asked by At

I am getting this error while trying partially evaluate a very simple query against a very simple policy which consists of a very simple complete rule. Working on MacOS, but getting same error on Linux also. Am I missing something?

Command: opa eval "data.policy.allow" -i policy.json -d ./policy.rego -f pretty -p -u '[input.akey]'

Error:

panic: illegal value

goroutine 1 [running]:
github.com/open-policy-agent/opa/topdown.newSaveSetElem(...)
        github.com/open-policy-agent/opa/topdown/save.go:132
github.com/open-policy-agent/opa/topdown.(*saveSet).Push(0x140003fb440, {0x140000cb150, 0x1, 0x1?}, 0x14000020060)
        github.com/open-policy-agent/opa/topdown/save.go:31 +0x3ec
github.com/open-policy-agent/opa/topdown.newSaveSet({0x140000cb150, 0x1, 0x1}, 0x0?, 0x0)
        github.com/open-policy-agent/opa/topdown/save.go:26 +0xb4
github.com/open-policy-agent/opa/topdown.(*Query).PartialRun(0x1400011eb60, {0x1018fe7d8?, 0x10218aa40})
        github.com/open-policy-agent/opa/topdown/query.go:345 +0x604
github.com/open-policy-agent/opa/rego.(*Rego).partial(0x14000116700, {0x1018fe7d8?, 0x10218aa40}, 0x14000196480)
        github.com/open-policy-agent/opa/rego/rego.go:2376 +0x794
github.com/open-policy-agent/opa/rego.PreparedPartialQuery.Partial({{0x14000116700?, 0x140004d5950?}}, {0x1018fe7d8, 0x10218aa40}, {0x1400004f1b0?, 0x10075b754?, 0x1028719a0?})
        github.com/open-policy-agent/opa/rego/rego.go:485 +0xfc
github.com/open-policy-agent/opa/cmd.evalOnce({0x1018fe7d8, 0x10218aa40}, 0x14000234c00)
        github.com/open-policy-agent/opa/cmd/eval.go:449 +0xbdc
github.com/open-policy-agent/opa/cmd.eval({_, _, _}, {0x140004d5398, 0x0, 0x1, {0x1400004eca0, 0x1, 0x1}, {0x10218aa40, ...}, ...}, ...)
        github.com/open-policy-agent/opa/cmd/eval.go:356 +0x30c
github.com/open-policy-agent/opa/cmd.init.5.func2(0x14000199500?, {0x140001681e0?, 0x4?, 0x1011945c9?})
        github.com/open-policy-agent/opa/cmd/eval.go:276 +0x64
github.com/spf13/cobra.(*Command).execute(0x14000199500, {0x140001680a0, 0xa, 0xa})
        github.com/spf13/[email protected]/command.go:944 +0x640
github.com/spf13/cobra.(*Command).ExecuteC(0x10213c700)
        github.com/spf13/[email protected]/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x10203bb08?)
        github.com/spf13/[email protected]/command.go:992 +0x1c
main.main()
        github.com/open-policy-agent/opa/main.go:14 +0x24

policy.rego:

package policy

allow {
  input.akey == 1
}

OPA version:

Version: 0.57.1
...
Go Version: go1.21.3
Platform: darwin/arm64
...
0

There are 0 answers