{"record":{"id":"c62fb133d7ea7fba","repo":"dgraph-io/dgraph","slug":"can-t-convert-input-to-map-c62fb1","errorCode":null,"errorMessage":"can't convert input to map","messagePattern":"can't convert input to map","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/admin/removeNode.go","lineNumber":48,"sourceCode":"\t\treturn resolve.EmptyResult(m, err), false\n\t}\n\n\tif _, err = worker.RemoveNodeOverNetwork(ctx, &pb.RemoveNodeRequest{NodeId: input.NodeId,\n\t\tGroupId: input.GroupId}); err != nil {\n\t\treturn resolve.EmptyResult(m, err), false\n\t}\n\n\treturn resolve.DataResult(m,\n\t\tmap[string]interface{}{m.Name(): response(\"Success\",\n\t\t\tfmt.Sprintf(\"Removed node with group: %v, idx: %v\", input.GroupId, input.NodeId))},\n\t\tnil,\n\t), true\n}\n\nfunc getRemoveNodeInput(m schema.Mutation) (*removeNodeInput, error) {\n\tinputArg, ok := m.ArgValue(schema.InputArgName).(map[string]interface{})\n\tif !ok {\n\t\treturn nil, inputArgError(errors.Errorf(\"can't convert input to map\"))\n\t}\n\n\tinputRef := &removeNodeInput{}\n\tnodeId, err := parseAsUint64(inputArg[\"nodeId\"])\n\tif err != nil {\n\t\treturn nil, inputArgError(schema.GQLWrapf(err, \"can't convert input.nodeId to uint64\"))\n\t}\n\tinputRef.NodeId = nodeId\n\n\tgId, err := parseAsUint32(inputArg[\"groupId\"])\n\tif err != nil {\n\t\treturn nil, inputArgError(schema.GQLWrapf(err, \"can't convert input.groupId to uint32\"))\n\t}\n\tinputRef.GroupId = gId\n\n\treturn inputRef, nil\n}\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/admin/removeNode.go#L30-L66","documentation":"getRemoveNodeInput reads the 'input' argument of the removeNode admin mutation and, like moveTablet, requires it to be a map[string]interface{}. If the argument cannot be type-asserted to a map, inputArgError wraps this message and the mutation fails. It means the resolver never received a structured input object.","triggerScenarios":"Calling removeNode with a missing/misnamed input argument, a scalar instead of an object, or via a raw client that bypasses GraphQL coercion so ArgValue is not a map.","commonSituations":"Hand-written admin mutations omitting the input wrapper ({ removeNode(nodeId: 1) } instead of { removeNode(input: { nodeId: 1 }) }), GraphQL variables typed as a string or number instead of an object, or outdated client SDKs predating the input-object signature.","solutions":["Send input as an object: { removeNode(input: { nodeId: 1 }) }.","When using variables, declare $input: RemoveNodeInput! and supply a JSON object in the variables payload.","Confirm the argument key is 'input' and the input type name matches the current admin schema.","Log/inspect the outgoing request body; ensure the input field is a JSON object, not a quoted string.","Regenerate client bindings from the live schema if the mutation signature changed after an upgrade."],"exampleFix":"// before\nmutation { removeNode(nodeId: 1) { response { message } } }\n// after\nmutation { removeNode(input: { nodeId: 1 }) { response { message } } }","handlingStrategy":"validation","validationCode":"function assertRemoveNodeInput(v) {\n  if (v === null || typeof v !== 'object' || Array.isArray(v)) {\n    throw new Error('removeNode input must be an object like {nodeId}');\n  }\n  return v;\n}","typeGuard":"function isPlainObject(v) { return v !== null && typeof v === 'object' && !Array.isArray(v); }","tryCatchPattern":"try {\n  await gql(`mutation Rm($input: RemoveNodeInput!){ removeNode(input: $input){...} }`, { input });\n} catch (e) {\n  if (String(e.message).includes(\"can't convert input to map\")) {\n    // rebuild input as a proper object and retry once\n  }\n}","preventionTips":["Wrap nodeId in an input object: removeNode(input: { nodeId: 1 })","Type variables as RemoveNodeInput! rather than scalars","Keep SDKs regenerated against the current admin schema","Smoke-test admin mutations in the playground first","Never pass input as a JSON-encoded string"],"tags":["graphql","input-validation","admin-api","mutation"],"backgroundTag":"invalid-graphql-input","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}