Error: Parse Error at Line X


(Brett Sauve) #1

Meaning of Error

In Looker, you might come across an error of this form:

<Parse error at line 40>

If this occurs, it means you have broken a syntax rule near the line mentioned.

## Line Number Mentioned in Error

Sometimes the line number that is mentioned in the error message is the line that is causing the error. However, it is not uncommon for the error to be caused by a line just before the line that is mentioned in the message. For example, consider this block of LookML:

36  - dimension: example_a
37    html: <a href="my.link.com?b={{ row['example_b.id'] }}">link</a>
38    required_fields: [example_b.id
39
40  - dimension: example_c
41    type: int
42    sql: ${TABLE}.example_c

In this case there is a missing closing bracket at the end of row 38. Even though the error is a result of row 38, the message mentions row 40.

Common Causes of this Error in YAML-based LookML

  • You have not properly indented the line of LookML
  • You have not used a pipe (the | character found above the backslash) to indicate that you want to write SQL or HTML on multiple rows
  • You have not closed a bracket (the ] character) in your LookML
  • Your code includes a YAML special character, such as >, and it needs to be escaped with quotes. This is common in filters on fields.