better error message on invalid subgraph