> ## Documentation Index
> Fetch the complete documentation index at: https://helix-digitalocean.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# E641

# Closure Position Restriction

## Erroneous Code Example

This error occurs when you place a closure operation in a position other than the last step of a traversal.

In this example, the closure is not at the end of the traversal.

<CodeGroup>
  ```rust queries.hx theme={null}
  Query getUser(userId: ID) =>
      user <- N<User>(userId)
      RETURN user::|u|{
                  userID: u::ID
              }::Out<Knows>
  ```
</CodeGroup>

# Solution

Place closure operations only at the end of traversals.

<CodeGroup>
  ```rust queries.hx theme={null}
  Query getUser(userId: ID) =>
      user <- N<User>(userId)
      out_users <- user::Out<Knows>
      RETURN out_users, user::|u|{
                              userID: u::ID
                          }::Out<Knows>
  ```
</CodeGroup>
