# Hasura: error applying metadata "parsing the graphql query failed" code "parse-failed" on query_collections
## What's going on
The reporter generated Hasura migrations from an existing project via the console and tried applying them to a new instance. The CLI failed with a fatal error: error applying metadata, path $.args.metadata.query_collections[0].definition.queries[1].query, "parsing the graphql query failed", code "parse-failed". The failing collection was the default allow-list entry created from a GraphQL mutation saved in the console. CLI version v2.0.8-cloud.3, server v2.0.9.
## The verified fix
This was caused by stray trailing whitespace inside the saved GraphQL mutation in query_collections.yaml. Hasura's parser choked on a space after a comma, e.g. name: "example", with a trailing space, which is legal GraphQL but broke the metadata apply. The maintainer reproduced it and confirmed removing the trailing space fixed the parse. To fix: open metadata/query_collections.yaml, find the failing query, and delete any trailing spaces at end of lines or after commas inside the GraphQL document. Then regenerate the migration and re-apply; the reporter confirmed it applied successfully after this. Workarounds others used: run the query through stripIgnoredCharacters from graphql-js before saving, or hit Prettify in the GraphiQL playground before creating a REST endpoint. Source: https://github.com/hasura/graphql-engine/issues/7616
## How to use this
Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.