# Bug: Execution Failed Because Some Variables are Defined But Not Used

**URL:** <https://discuss.dgraph.io/t/bug-execution-failed-because-some-variables-are-defined-but-not-used/14825>\
**Category:** GraphQL\
**Tags:** status:accepted, kind:bug, ticket:created\
**Created:** [July 4, 2021, 4:38pm UTC](https://discuss.dgraph.io/t/bug-execution-failed-because-some-variables-are-defined-but-not-used/14825 "2021-07-04T16:38:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdgamble555](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/jdgamble555/32/7503_2.png) [@jdgamble555](https://discuss.dgraph.io/u/jdgamble555)\
**Post date:** [July 4, 2021, 4:38pm UTC](https://discuss.dgraph.io/t/bug-execution-failed-because-some-variables-are-defined-but-not-used/14825/1 "2021-07-04T16:38:09Z")

</div>

## Report a GraphQL Bug

### What edition and version of Dgraph are you using?

**Cloud DGraph**

#Dgraph Version 

```auto
$ v21.03.0-58-g17f52bc78

```

### Have you tried reproducing the issue with the latest release?

Yup, using it.

### Steps to reproduce the issue (paste the query/schema if possible)

In my standard Tasks Test App, I add some todos, then try to delete them:

**Schema:**

```typescript
type Task @withSubscription @auth(query: { rule: "query($EMAIL: String!) { queryTask { user(filter: { email: { eq: $EMAIL } }) { email } id } }"}) {
	id: ID!
	title: String! @search(by:[fulltext])
	completed: Boolean! @search
	user: User!
}

type User @withSubscription @auth( query: { rule: "query($EMAIL: String!) { queryUser(filter: {email: { eq: $EMAIL } }){ email } }" }) {
	email: String! @search(by:[hash]) @id
	displayName: String!
	tasks: [Task] @hasInverse(field:user)
    createdAt: DateTime!
}

# Dgraph.Authorization {"Header":"X-Auth-Token","Namespace":"https://dgraph.io/jwt/claims","JWKURL":"https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com","Audience":["MY_AUDIENCE"]}

```

1. Add some todos..
2. Try and delete them with this query:

```typescript
mutation { deleteTask(filter: { id: "0xfffd8d6a978a685b" }) { task { title completed user { email } } numUids msg } }

```

And it does not work, get this error:

```typescript
[GraphQL] couldn't execute query for mutation deleteTask because Dgraph execution failed because Some variables are defined but not used
Defined:[Task_3 Task_5 Task_Auth6 User_Auth4 x]
Used:[Task_3 Task_5 Task_Auth6 x]

```

### Expected behavior and actual result.

Item would get deleted with no error.

However, this does work fine (by not returning any task):

```typescript
mutation { deleteTask(filter: { id: "0xfffd8d6aa9866395" }) { numUids msg } }

```

Not sure if this is related to this post:

> **[Mutation failed because Dgraph execution failed because Some variables are...](https://discuss.dgraph.io/t/mutation-failed-because-dgraph-execution-failed-because-some-variables-are-used-but-not-defined/12884)**
>
> For the following schema interface ValueMetadata { id: ID! createdAt: DateTime! deletedAt: DateTime author: Author! @hasInverse(field:values) owner: Organization! @hasInverse(field:values) } type StringValue implements ValueMetadata { ...

It is also worth noting that I am using **subscriptions** and **urql** , so it is not as important to keep the cache up-to-date with a return value, however, I would imagine it should still not produce this error.

J
