{"record":{"id":"ad1f536514a1215d","repo":"dgraph-io/dgraph","slug":"invalid-argument-s","errorCode":null,"errorMessage":"Invalid argument: %s","messagePattern":"Invalid argument: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"query/query.go","lineNumber":596,"sourceCode":"\t\t\targs.Cascade.Fields = gchild.Cascade\n\t\t}\n\n\t\t// Remove pagination arguments from the query if @cascade is mentioned since\n\t\t// pagination will be applied post processing the data.\n\t\tif len(args.Cascade.Fields) > 0 {\n\t\t\targs.addCascadePaginationArguments(gchild)\n\t\t}\n\n\t\tif gchild.IsCount {\n\t\t\tif len(gchild.Children) != 0 {\n\t\t\t\treturn errors.New(\"Node with count cannot have child attributes\")\n\t\t\t}\n\t\t\targs.DoCount = true\n\t\t}\n\n\t\tfor argk := range gchild.Args {\n\t\t\tif !isValidArg(argk) {\n\t\t\t\treturn errors.Errorf(\"Invalid argument: %s\", argk)\n\t\t\t}\n\t\t}\n\t\tif err := args.fill(gchild); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(args.Order) != 0 && len(args.FacetsOrder) != 0 {\n\t\t\treturn errors.Errorf(\"Cannot specify order at both args and facets\")\n\t\t}\n\n\t\tdst := &SubGraph{\n\t\t\tAttr:   gchild.Attr,\n\t\t\tParams: args,\n\t\t}\n\t\tif gchild.MathExp != nil {\n\t\t\tmathExp := &mathTree{}\n\t\t\tif err := mathCopy(mathExp, gchild.MathExp); err != nil {\n\t\t\t\treturn err","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/query/query.go#L578-L614","documentation":"Each argument on a query node must be one of the recognized keywords (first, offset, after, orderasc, orderby, filter, facets, cascade, etc.). treeCopy iterates gchild.Args and calls isValidArg; an unknown key means the query is malformed or uses syntax from another engine, so parsing is aborted with the offending argument name.","triggerScenarios":"Typo like `orderasc:` misspelled as `orderAsc` or `oderby`; passing an arbitrary option such as `limit: 5` (not a Dgraph arg); query builders injecting custom parameters into the query string.","commonSituations":"Hand-written queries with typos; porting GraphQL/SQL options (limit/skip) that Dgraph does not support by that name; old syntax removed in a Dgraph upgrade.","solutions":["Fix the argument spelling to a supported one (first, offset, after, orderasc, orderdesc, orderby, filter, facets, groupby, recurse, cascade, depth, etc.)","Replace unsupported options with Dgraph equivalents: pagination is (first, offset) and (after, first)","Check the predicate is not being passed where an argument belongs; move values into func(...) or @filter instead"],"exampleFix":"// before\n{\n  me(func: type(Person), limit: 5) { uid }\n}\n// after\n{\n  me(func: type(Person), first: 5) { uid }\n}","handlingStrategy":"validation","validationCode":"const VALID_ARGS = new Set(['first','offset','after','orderasc','orderdesc','orderby','filter','facets','groupby','cascade','recurse','depth','loop','numpaths','minweight','maxweight','numhops','maxfrontiersize','from','to','func','expand']);\nfor (const [k] of node.args) {\n  if (!VALID_ARGS.has(k)) throw new Error(`Unknown Dgraph argument: ${k}`);\n}","typeGuard":"const isValidDgraphArg = (k) => VALID_ARGS.has(k);","tryCatchPattern":"try {\n  await txn.query(q);\n} catch (e) {\n  if (e.message.startsWith('Invalid argument:')) {\n    const bad = e.message.split('Invalid argument: ')[1];\n    console.error(`Remove or correct argument \"${bad}\"`);\n  }\n  throw e;\n}","preventionTips":["Keep an allowlist of Dgraph query arguments in your query builder","Map SQL/GraphQL options (limit/skip) to first/offset before emitting","Re-check args after Dgraph upgrades, as supported args change"],"tags":["dgraph","query","argument","validation"],"backgroundTag":"invalid-query-argument","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}