Skip to content
  • Getting Started
  • HELP
  • Error Messages
  • UNBOUND_VARIABLE

Error code: UNBOUND_VARIABLE

This guide explains why you may experience an unbound variable error and how to solve it.

A variable in Rel is considered to be not bound or unbound if there is an unknown source of values for it. The difference between ungrounded and unbound variables refers to how the error is detected by the system, i.e., unbound is used when the problem can be detected by applying purely syntactic criteria. In this sense, unbound implies ungrounded. The unbound errors come from the front-end compiler, whereas the ungrounded ones come from the query optimizer.

The following example returns an unbound variable error:

def r(x, y) = {x = 1}
Error example from the RAI Console

You have defined the relation r and declared the value for the variable x. However, this didn’t happen for the variable y, and therefore the system cannot obtain values for it. A correct example could be something like this:

// query
 
def r(x, y) = {x = 1 and y = 2}
def output = r
Loading sol1-unb...

Check out the Rel Language and the Rel Primer: Advanced Syntax guides for further details on this topic.

Was this doc helpful?