{"record":{"id":"6f0c68b3dc9531f9","repo":"dgraph-io/dgraph","slug":"id-argument-s-was-not-able-to-be-parsed","errorCode":null,"errorMessage":"ID argument (%s) was not able to be parsed","messagePattern":"ID argument \\((.+?)\\) was not able to be parsed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/resolve/mutation_rewriter.go","lineNumber":1177,"sourceCode":"func (drw *deleteRewriter) RewriteQueries(\n\tctx context.Context,\n\tm schema.Mutation) ([]*dql.GraphQuery, []string, error) {\n\n\tdrw.VarGen = NewVariableGenerator()\n\n\treturn []*dql.GraphQuery{}, []string{}, nil\n}\n\nfunc asUID(val interface{}) (uint64, error) {\n\tif val == nil {\n\t\treturn 0, errors.Errorf(\"ID value was null\")\n\t}\n\n\tid, ok := val.(string)\n\tuid, err := strconv.ParseUint(id, 0, 64)\n\n\tif !ok || err != nil {\n\t\treturn 0, errors.Errorf(\"ID argument (%s) was not able to be parsed\", id)\n\t}\n\n\treturn uid, nil\n}\n\nfunc addAuthSelector(t schema.Type) *schema.RuleNode {\n\tauth := t.AuthRules()\n\tif auth == nil || auth.Rules == nil {\n\t\treturn nil\n\t}\n\n\treturn auth.Rules.Add\n}\n\nfunc updateAuthSelector(t schema.Type) *schema.RuleNode {\n\tauth := t.AuthRules()\n\tif auth == nil || auth.Rules == nil {\n\t\treturn nil","sourceCodeStart":1159,"sourceCodeEnd":1195,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/resolve/mutation_rewriter.go#L1159-L1195","documentation":"asUID received a value that is not nil but could not be converted to a uint64 UID: either the value was not a string (ok==false) or strconv.ParseUint failed on the string. The error includes the offending value so developers can see what was actually passed. Called from checkUIDExistsQuery and addDelete during delete mutations.","triggerScenarios":"Passing an id argument with a non-numeric string (e.g. 'abc', an XID instead of a hex UID, or '0x' prefix missing), or a non-string JSON type (number) into asUID where only strings are supported.","commonSituations":"Using an external/@id string value where the internal hex UID (0x1) is expected; passing numeric IDs (1234) serialized as JSON numbers; typos or whitespace in the UID string.","solutions":["Pass the internal hex UID string (e.g. \"0x1234\") obtained from a prior query/add response","If using @id/XID values, query the node first to resolve its UID, or use the proper XID-based filter path","Ensure the id argument is a string, not a JSON number","Trim whitespace and validate the UID format (strconv.ParseUint base 0) before sending"],"exampleFix":"// before\ndeletePost(id: \"my-xid-value\")\n// after\ndeletePost(id: \"0x2\") // hex UID from query result","handlingStrategy":"type-guard","validationCode":"function isParsableUID(v) {\n  return typeof v === 'string' && !isNaN(Number.parseInt(v, v.startsWith('0x') ? 16 : 10));\n}","typeGuard":"function isUidString(v) { return typeof v === 'string' && /^0x[0-9a-fA-F]+$/.test(v.trim()); }","tryCatchPattern":"try {\n  await deleteMutation({ id });\n} catch (err) {\n  if (err.message.startsWith('ID argument (')) {\n    // resolve the real hex UID via query, then retry\n  }\n}","preventionTips":["Always pass hex UIDs (\"0x...\") from prior query results","Resolve @id/XID values to UIDs before delete mutations","Keep id arguments as strings, not JSON numbers","Trim/normalize ID strings before sending"],"tags":["graphql","delete-mutation","id-parsing"],"backgroundTag":"invalid-uid-format","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}