Fix detection of instantiation errors when compiling entity relations, directives, and clauses