Explain why a Rego query is undefined
rego_explain_undefinedDiagnose why a Rego query returns no value or its default by tracing evaluation and analyzing conditions to pinpoint the exact rule body expression that blocks each rule.
Instructions
Diagnose why a fully-qualified Rego query (e.g. "data.authz.allow") produces no value, or falls back to its default. Combines a plain eval, a full-trace eval, and per-condition AST analysis to identify the exact body expression blocking each rule. Handles both runtime failures (trace-based) and indexer elimination (standalone condition eval). A rule written with default allow := false always has a value, so queryResult reports default for it and the same per-rule breakdown follows: the question "why is allow false" is the question this answers. Returns a structured breakdown of which conditions blocked each rule plus a human-readable summary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | No | Input document (JSON value) for the query. | |
| paths | No | Policy .rego file paths to load. Mutually exclusive with source. | |
| query | Yes | Fully-qualified rule reference to explain, e.g. "data.authz.allow". Must match the path you would pass to rego_eval. | |
| source | No | Inline Rego source to analyse. Mutually exclusive with paths. | |
| inputPath | No | Path to an input JSON file. | |
| v0Compatible | No | Read the policy as Rego v0 (`--v0-compatible`), the syntax OPA used before 1.0: rules without `if`, partial sets as `deny[msg] { ... }`. Needed for a policy that has not been migrated, which OPA 1.x otherwise refuses to load. Where the tool also takes a query, the query is read as v0 too, with the future keywords imported so `in`, `every` and `some x in` still work in it. |