Dgraph query failed because Dgraph execution failed because Some variables are declared multiple times

This error message is useless. Is there any way to figure out why my query is wrong?

Hey @droslean, Can you share the query?

I could but I don’t see how that will help. The error message is useless. There is no duplicate in my query for sure so I believe that this is more complicated. Perhaps it’s a combination of the schema and what the query is trying to do.

Can you give me some insights on what to look for?

This error never happen in another situation. Just when you really have duplicated variables. Machines don’t lie™.

Double check your query. This have happened to me too in the past.

Thanks @MichelDiz . No duplicates… I rechecked. Also, my query is automatically generated which is quite unlikely that there is a duplicate. Either way, I triple checked it. There is no duplication.

Assuming you are using DQL? Post the query to help get past the initial debugging mode for the devs who want to help you.

@amaster507 I am not using DQL. My query is a graphql query, and dgraph response with the error in question.

1 Like

queryBonus.gql (66.4 KB)

There are no duplication in this query.

1 Like

That was the reason for my question. It is a DQL error and not a GraphQL error. So the problem is when the GraphQL gets rewritten into DQL. Do you use any auth directives in your GraphQL schema? Those can get written into DQL vars too.

They don’t lie, but they can be buggy. This looks to be a GraphQL → DQL rewriting bug that probably involves some @auth rules too if I can make an educated guess from prior experiences.

1 Like

@droslean, It’s hard to replicate without a graph with your schema in place. But as a simple test, could you remove the unused variable parameters in your declaration of QueryBonus. I know Dgraph will error if it finds unused variables in a query.

@droslean Well, this is a huge query. Wow.
We can set up a call to debug this in your end if you are available close to my timezone.

All we will need is docker, create a new cluster with your data in order to debug it.

If it is just the rewriter bug, then all you will need is the full schema and query. It should create the error without any actual data as this is a pre query error.

1 Like