A panic was trapped on a simple mutation


I have a Type Task which queries fine and returns the following

query MyQuery {
queryTask {

“data”: {
“queryTask”: [
“iD”: “0x4e41”,
“title”: “Task 1”,
“extensions”: {


When I try and do a basic mutation to change the title created with the api explorer tool

mutation MyMutation {
updateTask(input: {filter: {iD: “0x4e41”}, set: {title: “Bob”}}) {

I get the error

“errors”: [
“message”: “Internal Server Error - a panic was trapped. This indicates a bug in the GraphQL server. A stack trace was logged. Please let us know by filing an issue with the stack trace.”

I am new to this but thought I would get past the graph QL equivalent of ‘hello world!’ :wink:

Any ideas?

Hi @haPartnerships,

Welcome to Dgraph Community !!

I was able to reproduce this issue. The problem occurs because iD in filter expects a list of IDs while just the ID has been provided.

The update mutation should work with the following input to updateTask,

updateTask(input: {filter: {iD: [ “0x4e41” ] }, set: {title: “Bob”}})

Note the [ ] around "0x4e41" .

Thanks for the post. I do agree that the error thrown should have been more verbose and pointed towards the fact that there is something wrong with the input provided to update mutation rather than panicking. I am accepting this panicking as a bug and it will be fixed to a more verbose error.

Do let us know if you have any other questions.

Reference for Update Mutations: https://dgraph.io/docs/graphql/mutations/update/ .

For the sake of completeness, This PR has fixed this behaviour on master branch. Later slash graphql and dgraph releases will also have support for coercing a single object to list.

The update mutation won’t cause panic and will update the node gracefully on using master or later releases.