Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E301

For the complete documentation index optimized for AI agents, see llms.txt.

Variable Not in Scope

Erroneous Code Example

This error occurs when you try to reference a variable that is not currently in scope or has not been declared.

In this example, the variable userId is not declared.

Query getUser() =>
    user <- N<User>(userId)
    RETURN user

Solution

Declare the variable as a parameter before using it.

Query getUser(userId: ID) =>
    user <- N<User>(userId)
    RETURN user