{"record":{"id":"873f0194088fa8e7","repo":"dgraph-io/dgraph","slug":"scalar-value-supplied-for-argument-s-in-s-s","errorCode":null,"errorMessage":"scalar value supplied for argument `%s` in %s `%s`, only Variable, Object, or List values are allowed.","messagePattern":"scalar value supplied for argument `(.+?)` in (.+?) `(.+?)`, only Variable, Object, or List values are allowed\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/remote.go","lineNumber":509,"sourceCode":"\t\t\t\tif givenElem.Value.Kind != ast.ObjectValue {\n\t\t\t\t\treturn errors.Errorf(\"argument `%s` in %s `%s` of List kind has non-object\"+\n\t\t\t\t\t\t\" elements, Lists can have only objects as element.\", givenArgName,\n\t\t\t\t\t\t*md.operationType, *md.givenQryName)\n\t\t\t\t}\n\t\t\t\tif err := matchArgSignature(&argMatchingMetadata{\n\t\t\t\t\tgivenArgVals:  getObjChildrenValsAsMap(givenElem.Value),\n\t\t\t\t\tgivenVarTypes: md.givenVarTypes,\n\t\t\t\t\tremoteArgMd:   remoteObjChildMap,\n\t\t\t\t\tremoteTypes:   md.remoteTypes,\n\t\t\t\t\tgivenQryName:  md.givenQryName,\n\t\t\t\t\toperationType: md.operationType,\n\t\t\t\t\tschema:        md.schema,\n\t\t\t\t}); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"scalar value supplied for argument `%s` in %s `%s`, \"+\n\t\t\t\t\"only Variable, Object, or List values are allowed.\", givenArgName,\n\t\t\t\t*md.operationType, *md.givenQryName)\n\n\t\t}\n\t}\n\n\t// check all non-null args required by remote query/mutation are present in given query/mutation\n\tfor _, remoteArgName := range md.remoteArgMd.requiredArgs {\n\t\t_, ok := md.givenArgVals[remoteArgName]\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"argument `%s` in %s `%s` is missing, it is required by remote\"+\n\t\t\t\t\" %s.\", remoteArgName, *md.operationType, *md.givenQryName, *md.operationType)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/remote.go#L491-L527","documentation":"matchArgSignature only supports three kinds of supplied argument values: variables (ast.Variable), object values (ast.ObjectValue), and list values (ast.ListValue). Any other value kind — bare scalars like ints, strings, booleans, enums, or null — falls into the default branch and raises this error. The remote validation path is designed for structured/forwardable arguments, not inline scalar literals.","triggerScenarios":"validateRemoteGraphql -> matchArgSignature on a query passing a literal scalar/enum argument to a remote operation, e.g. `query { user(age: 30) }` or `query { user(status: ACTIVE) }`, where the value kind is not Variable/Object/List.","commonSituations":"Hand-written queries with inline literal arguments; query builders that inline values instead of parameterizing them; enum literals supplied directly; generated queries missing variable substitution.","solutions":["Convert the inline literal to a variable: `query($age: Int!) { user(age: $age) }` and supply the value via the variables map.","If the argument is genuinely a scalar and remote validation must accept it, wrap it as a variable in the composed query (the library's supported path).","Check whether the value should be an object/list per the remote argument kind — a scalar here may signal the wrong argument shape.","If using a code generator, configure it to emit variables instead of inlining constants."],"exampleFix":"// before\nquery { user(age: 30) }\n// after\nquery($age: Int!) { user(age: $age) }","handlingStrategy":"validation","validationCode":"// Parameterize scalar literals as variables before composition\n// instead of: query { user(age: 30) }\n// emit:       query($age: Int!) { user(age: $age) }\nfunc checkValueKinds(q *ast.OperationDefinition, remoteArgs map[string]*ast.ArgumentDefinition) error {\n    for _, a := range q.Selections... { // reject value kinds other than Variable/Object/List\n    }\n    return nil\n}","typeGuard":"func isSupportedArgValue(k ast.ValueKind) bool {\n    return k == ast.Variable || k == ast.ObjectValue || k == ast.ListValue\n}","tryCatchPattern":"if err := validateRemoteGraphql(...); err != nil {\n    if strings.Contains(err.Error(), \"scalar value supplied for argument\") {\n        return fmt.Errorf(\"convert literal to variable: %w\", err)\n    }\n    return err\n}","preventionTips":["Always parameterize arguments with variables in remote-composed queries","Configure code generators to emit variables, not inline constants","Lint for inline literal arguments in query templates"],"tags":["graphql","arguments","scalar"],"backgroundTag":"graphql-argument-kind-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}