The Error
When you are working on a LookML file, after you validate your code in the Content Validator you might come across an error of the form Redefinition of field 'view_name.field_name'.
It will look like this on the left side of your screen, under the LookML errors:
What Does This Error Mean?
This error means that Looker sees two fields with exactly the same combination of view and field names.
Common Causes of This Error:
- You have accidentally named two fields with the same name in the same view. This could be:
- Two dimensions with the same name.
- Two measures with the same name.
- One dimension and one measure with the same name.
- You copied and pasted a field in a view and forgot to change the name.
- You joined a view to your Explore a second time but forgot to give the join a different name.
- You used the LookML generator and your table already had a column named “count.” In this case Looker will create a dimension named "count," which references the column in your table. By default, Looker will also create a measure named "count" (which is the only default measure that Looker creates). Since the two fields are both named "count," an error occurs.
Finding the view_name
Mentioned in the Error
Keep in mind that the view_name
mentioned in the error will be the view name as it is defined in the explore
where the view is joined.
Simple Case
For the typical case, the view name is easy to understand. For example, you could have the following join:
join: address
foreign_key: order.billing_id
In the example above, the view_name
mentioned in the error will be “address,” as you would expect.
When a View is Aliased in the Join
If you are using aliasing, the alias name will be mentioned in the error message. For example, suppose you have a join using the from parameter. This is especially useful when you want to join the same view a second time. The from
parameter lets you give the join (and its fields) a different name than the underlying view.
join: billing_address
from: address
foreign_key: order.billing_id
In the example above, the view_name
mentioned in the error from the LookML view file will be “billing_address” and not “address.”