STET

agent_patch

runs/2026-02-28__13-38-10__gpt-5-4/flux-pr-1034/flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/agent-logs/agent.patch

23487 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/engine/execution_engine.go b/app/execution/engine/execution_engine.go
index 823882f..9b2e630 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/engine/execution_engine.go
+++ b/app/execution/engine/execution_engine.go
@@ -175,6 +175,7 @@ func (e *ExecutionEngine) Execute(ctx context.Context, operation *graphql.Reques
 		// Normalize the operation again, this time just extracting additional variables from arguments.
 		result, err := operation.Normalize(e.config.schema,
 			astnormalization.WithExtractVariables(),
+			astnormalization.WithRemapVariables(),
 		)
 		if err != nil {
 			return err
@@ -187,6 +188,7 @@ func (e *ExecutionEngine) Execute(ctx context.Context, operation *graphql.Reques
 	if len(operation.Variables) > 0 && operation.Variables[0] == '{' {
 		validator := variablesvalidation.NewVariablesValidator(variablesvalidation.VariablesValidatorOptions{
 			ApolloCompatibilityFlags: e.apolloCompatibilityFlags,
+			VariableNameLookup:       operation.OriginalVariableName,
 		})
 		if err := validator.Validate(operation.Document(), e.config.schema.Document(), operation.Variables); err != nil {
 			return err
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/engine/execution_engine_test.go b/app/execution/engine/execution_engine_test.go
index db18169..3537fd2 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/engine/execution_engine_test.go
+++ b/app/execution/engine/execution_engine_test.go
@@ -711,7 +711,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
 					testNetHttpClient(t, roundTripperTestCase{
 						expectedHost:     "example.com",
 						expectedPath:     "/",
-						expectedBody:     `{"query":"query($heroNames: [String!]!){heroes(names: $heroNames)}","variables":{"heroNames":["Luke Skywalker","R2-D2"]}}`,
+						expectedBody:     `{"query":"query($a: [String!]!){heroes(names: $a)}","variables":{"a":["Luke Skywalker","R2-D2"]}}`,
 						sendResponseBody: `{"data":{"heroes":["Human","Droid"]}}`,
 						sendStatusCode:   200,
 					}),
@@ -777,7 +777,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
 					testNetHttpClient(t, roundTripperTestCase{
 						expectedHost:     "example.com",
 						expectedPath:     "/",
-						expectedBody:     `{"query":"query($heroNames: [String!], $height: String){heroes(names: $heroNames, height: $height)}","variables":{"height":null}}`,
+						expectedBody:     `{"query":"query($a: [String!], $b: String){heroes(names: $a, height: $b)}","variables":{"b":null}}`,
 						sendResponseBody: `{"data":{"heroes":[]}}`,
 						sendStatusCode:   200,
 					}),
@@ -1032,7 +1032,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
 					testNetHttpClient(t, roundTripperTestCase{
 						expectedHost:     "example.com",
 						expectedPath:     "/",
-						expectedBody:     `{"query":"query($ids: [Int]){charactersByIds(ids: $ids){name}}","variables":{"ids":[1]}}`,
+						expectedBody:     `{"query":"query($a: [Int]){charactersByIds(ids: $a){name}}","variables":{"a":[1]}}`,
 						sendResponseBody: `{"data":{"charactersByIds":[{"name": "Luke"}]}}`,
 						sendStatusCode:   200,
 					}),
@@ -1162,7 +1162,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
 							testNetHttpClient(t, roundTripperTestCase{
 								expectedHost:     "example.com",
 								expectedPath:     "/",
-								expectedBody:     `{"query":"query($name: String!, $nameOptional: String){hero(name: $name) hero2: hero(name: $nameOptional)}","variables":{"nameOptional":"R2D2","name":"R2D2"}}`,
+								expectedBody:     `{"query":"query($a: String!, $b: String){hero(name: $a) hero2: hero(name: $b)}","variables":{"b":"R2D2","a":"R2D2"}}`,
 								sendResponseBody: `{"data":{"hero":"R2D2","hero2":"R2D2"}}`,
 								sendStatusCode:   200,
 							}),
@@ -1225,7 +1225,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
 							testNetHttpClient(t, roundTripperTestCase{
 								expectedHost:     "example.com",
 								expectedPath:     "/",
-								expectedBody:     `{"query":"query($name: String!, $nameOptional: String){hero(name: $name) hero2: hero(name: $nameOptional)}","variables":{"nameOptional":"Skywalker","name":"Luke"}}`,
+								expectedBody:     `{"query":"query($a: String!, $b: String){hero(name: $a) hero2: hero(name: $b)}","variables":{"b":"Skywalker","a":"Luke"}}`,
 								sendResponseBody: `{"data":{"hero":"R2D2","hero2":"R2D2"}}`,
 								sendStatusCode:   200,
 							}),
@@ -1287,7 +1287,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
 							testNetHttpClient(t, roundTripperTestCase{
 								expectedHost:     "example.com",
 								expectedPath:     "/",
-								expectedBody:     `{"query":"query($name: String!, $nameOptional: String!){hero: heroDefault(name: $name) hero2: heroDefault(name: $nameOptional) hero3: heroDefaultRequired(name: $name) hero4: heroDefaultRequired(name: $nameOptional)}","variables":{"nameOptional":"R2D2","name":"R2D2"}}`,
+								expectedBody:     `{"query":"query($a: String!, $b: String!){hero: heroDefault(name: $a) hero2: heroDefault(name: $b) hero3: heroDefaultRequired(name: $a) hero4: heroDefaultRequired(name: $b)}","variables":{"b":"R2D2","a":"R2D2"}}`,
 								sendResponseBody: `{"data":{"hero":"R2D2","hero2":"R2D2","hero3":"R2D2","hero4":"R2D2"}}`,
 								sendStatusCode:   200,
 							}),
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/graphql/normalization.go b/app/execution/graphql/normalization.go
index 62253b0..c8f5b44 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/graphql/normalization.go
+++ b/app/execution/graphql/normalization.go
@@ -27,6 +27,7 @@ func (r *Request) Normalize(schema *Schema, options ...astnormalization.Option)
 	if len(options) == 0 {
 		options = []astnormalization.Option{
 			astnormalization.WithExtractVariables(),
+			astnormalization.WithRemapVariables(),
 			astnormalization.WithRemoveFragmentDefinitions(),
 			astnormalization.WithRemoveUnusedVariables(),
 			astnormalization.WithInlineFragmentSpreads(),
@@ -37,11 +38,13 @@ func (r *Request) Normalize(schema *Schema, options ...astnormalization.Option)
 		options = append(options, astnormalization.WithRemoveNotMatchingOperationDefinitions())
 		normalizer := astnormalization.NewWithOpts(options...)
 		normalizer.NormalizeNamedOperation(&r.document, &schema.document, []byte(r.OperationName), &report)
+		r.variableNames = normalizer.VariableMapping()
 	} else {
 		// TODO: we should validate count of operations - to throw an error
 		// and do full normalization for the single anonymous operation
 		normalizer := astnormalization.NewWithOpts(options...)
 		normalizer.NormalizeOperation(&r.document, &schema.document, &report)
+		r.variableNames = normalizer.VariableMapping()
 	}
 
 	if report.HasErrors() {
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/graphql/normalization_test.go b/app/execution/graphql/normalization_test.go
index 1eaa9f2..de2fe6a 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/graphql/normalization_test.go
+++ b/app/execution/graphql/normalization_test.go
@@ -40,16 +40,17 @@ func TestRequest_Normalize(t *testing.T) {
 		assert.True(t, result.Successful)
 		assert.True(t, request.isNormalized)
 
-		normalizedOperation := `query Fragments($droidID: ID!){
+		normalizedOperation := `query Fragments($a: ID!){
     hero {
         name
     }
-    droid(id: $droidID){
+    droid(id: $a){
         name
     }
 }`
 		op, _ := astprinter.PrintStringIndent(&request.document, "  ")
 		assert.Equal(t, normalizedOperation, op)
+		assert.Equal(t, "droidID", request.OriginalVariableName("a"))
 	})
 
 	runNormalizationWithSchema := func(t *testing.T, schema *Schema, request *Request, expectedVars string, expectedNormalizedOperation string) {
@@ -96,8 +97,8 @@ func TestRequest_Normalize(t *testing.T) {
 			Query: `query MySearch($s: String!, $other: String) {search(name: $s) {...on Human {name}}}`,
 		}
 
-		runNormalization(t, &request, `{"other":"other","s":"Luke"}`, `query MySearch($s: String!, $other: String){
-    search(name: $s){
+		runNormalization(t, &request, `{"a":"Luke","b":"other"}`, `query MySearch($a: String!, $b: String){
+    search(name: $a){
         ... on Human {
             name
         }
@@ -113,8 +114,8 @@ func TestRequest_Normalize(t *testing.T) {
 			}),
 			Query: `query MySearch($s: String!, $other: String) {search(name: $s) {...on Human {name}}}`,
 		}
-		runNormalization(t, &request, `{"s":"Luke"}`, `query MySearch($s: String!, $other: String){
-    search(name: $s){
+		runNormalization(t, &request, `{"a":"Luke"}`, `query MySearch($a: String!, $b: String){
+    search(name: $a){
         ... on Human {
             name
         }
@@ -171,8 +172,8 @@ func TestRequest_Normalize(t *testing.T) {
 			}),
 			Query: `query charactersByIds($ids: [Int]) {charactersByIds(ids: $ids) { name }}`,
 		}
-		runNormalizationWithSchema(t, schema, &request, `{"ids":[1]}`, `query charactersByIds($ids: [Int]){
-    charactersByIds(ids: $ids){
+		runNormalizationWithSchema(t, schema, &request, `{"a":[1]}`, `query charactersByIds($a: [Int]){
+    charactersByIds(ids: $a){
         name
     }
 }`)
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/graphql/request.go b/app/execution/graphql/request.go
index 1e10748..5be8eb6 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/execution/graphql/request.go
+++ b/app/execution/graphql/request.go
@@ -43,6 +43,7 @@ type Request struct {
 	request      resolve.Request
 
 	validForSchema map[uint64]ValidationResult
+	variableNames  map[string]string
 }
 
 func UnmarshalRequest(reader io.Reader, request *Request) error {
@@ -92,6 +93,16 @@ func (r *Request) InternalRequest() resolve.Request {
 	return r.request
 }
 
+func (r *Request) OriginalVariableName(name string) string {
+	if r.variableNames == nil {
+		return name
+	}
+	if originalName, ok := r.variableNames[name]; ok {
+		return originalName
+	}
+	return name
+}
+
 func (r *Request) Print(writer io.Writer) (n int, err error) {
 	report := r.parseQueryOnce()
 	if report.HasErrors() {
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/v2/pkg/astnormalization/astnormalization.go b/app/v2/pkg/astnormalization/astnormalization.go
index 1a667ae..c2e4c17 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/v2/pkg/astnormalization/astnormalization.go
+++ b/app/v2/pkg/astnormalization/astnormalization.go
@@ -106,6 +106,7 @@ type OperationNormalizer struct {
 	operationWalkers []walkerStage
 
 	removeOperationDefinitionsVisitor *removeOperationDefinitionsVisitor
+	variablesMapper                   *variablesMapperVisitor
 
 	options              options
 	definitionNormalizer *DefinitionNormalizer
@@ -146,6 +147,7 @@ type options struct {
 	removeFragmentDefinitions             bool
 	inlineFragmentSpreads                 bool
 	extractVariables                      bool
+	remapVariables                        bool
 	removeUnusedVariables                 bool
 	removeNotMatchingOperationDefinitions bool
 	normalizeDefinition                   bool
@@ -159,6 +161,12 @@ func WithExtractVariables() Option {
 	}
 }
 
+func WithRemapVariables() Option {
+	return func(options *options) {
+		options.remapVariables = true
+	}
+}
+
 func WithRemoveFragmentDefinitions() Option {
 	return func(options *options) {
 		options.removeFragmentDefinitions = true
@@ -244,6 +252,15 @@ func (o *OperationNormalizer) setupOperationWalkers() {
 		})
 	}
 
+	if o.options.remapVariables {
+		remapVariablesWalker := astvisitor.NewWalker(8)
+		o.variablesMapper = remapVariables(&remapVariablesWalker)
+		o.operationWalkers = append(o.operationWalkers, walkerStage{
+			name:   "remapVariables",
+			walker: &remapVariablesWalker,
+		})
+	}
+
 	other := astvisitor.NewWalker(8)
 	removeSelfAliasing(&other)
 	inlineSelectionsFromInlineFragments(&other)
@@ -287,6 +304,13 @@ func (o *OperationNormalizer) setupOperationWalkers() {
 	}
 }
 
+func (o *OperationNormalizer) VariableMapping() map[string]string {
+	if o.variablesMapper == nil {
+		return nil
+	}
+	return o.variablesMapper.mapping()
+}
+
 func (o *OperationNormalizer) prepareDefinition(definition *ast.Document, report *operationreport.Report) {
 	if o.definitionNormalizer != nil {
 		o.definitionNormalizer.NormalizeDefinition(definition, report)
diff --git a/app/v2/pkg/astnormalization/variables_mapper.go b/app/v2/pkg/astnormalization/variables_mapper.go
new file mode 100644
index 0000000..0a87221
--- /dev/null
+++ b/app/v2/pkg/astnormalization/variables_mapper.go
@@ -0,0 +1,157 @@
+package astnormalization
+
+import (
+	"encoding/json"
+
+	"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
+	"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
+	"github.com/wundergraph/graphql-go-tools/v2/pkg/internal/unsafebytes"
+)
+
+func remapVariables(walker *astvisitor.Walker) *variablesMapperVisitor {
+	visitor := &variablesMapperVisitor{
+		Walker: walker,
+	}
+	walker.RegisterEnterDocumentVisitor(visitor)
+	walker.RegisterEnterArgumentVisitor(visitor)
+	walker.RegisterLeaveDocumentVisitor(visitor)
+	return visitor
+}
+
+type variablesMapperVisitor struct {
+	*astvisitor.Walker
+	operation     *ast.Document
+	variableOrder []string
+	seenVariables map[string]struct{}
+	variableMap   map[string]string
+}
+
+func (v *variablesMapperVisitor) EnterDocument(operation, _ *ast.Document) {
+	v.operation = operation
+	v.variableOrder = v.variableOrder[:0]
+	if v.seenVariables == nil {
+		v.seenVariables = make(map[string]struct{})
+	}
+	for key := range v.seenVariables {
+		delete(v.seenVariables, key)
+	}
+	if v.variableMap == nil {
+		v.variableMap = make(map[string]string)
+	}
+	for key := range v.variableMap {
+		delete(v.variableMap, key)
+	}
+}
+
+func (v *variablesMapperVisitor) EnterArgument(ref int) {
+	v.collectVariables(v.operation.ArgumentValue(ref))
+}
+
+func (v *variablesMapperVisitor) collectVariables(value ast.Value) {
+	switch value.Kind {
+	case ast.ValueKindVariable:
+		name := v.operation.VariableValueNameString(value.Ref)
+		if _, ok := v.seenVariables[name]; ok {
+			return
+		}
+		v.seenVariables[name] = struct{}{}
+		v.variableOrder = append(v.variableOrder, name)
+	case ast.ValueKindList:
+		for _, ref := range v.operation.ListValues[value.Ref].Refs {
+			v.collectVariables(v.operation.Value(ref))
+		}
+	case ast.ValueKindObject:
+		for _, ref := range v.operation.ObjectValues[value.Ref].Refs {
+			v.collectVariables(v.operation.ObjectFieldValue(ref))
+		}
+	}
+}
+
+func (v *variablesMapperVisitor) LeaveDocument(operation, _ *ast.Document) {
+	for _, operationDefinition := range operation.OperationDefinitions {
+		if !operationDefinition.HasVariableDefinitions {
+			continue
+		}
+		for _, ref := range operationDefinition.VariableDefinitions.Refs {
+			name := operation.VariableDefinitionNameString(ref)
+			if _, ok := v.seenVariables[name]; ok {
+				continue
+			}
+			v.seenVariables[name] = struct{}{}
+			v.variableOrder = append(v.variableOrder, name)
+		}
+	}
+
+	for i, name := range v.variableOrder {
+		canonicalName := canonicalVariableName(i)
+		if name == canonicalName {
+			continue
+		}
+		v.variableMap[name] = canonicalName
+	}
+	if len(v.variableMap) == 0 {
+		return
+	}
+
+	for i := range operation.VariableValues {
+		name := unsafebytes.BytesToString(operation.Input.ByteSlice(operation.VariableValues[i].Name))
+		if canonicalName, ok := v.variableMap[name]; ok {
+			operation.VariableValues[i].Name = operation.Input.AppendInputString(canonicalName)
+		}
+	}
+
+	if len(operation.Input.Variables) == 0 {
+		return
+	}
+
+	remappedVariables, err := remapVariableInput(operation.Input.Variables, v.variableMap)
+	if err != nil {
+		v.StopWithInternalErr(err)
+		return
+	}
+	operation.Input.Variables = remappedVariables
+}
+
+func (v *variablesMapperVisitor) mapping() map[string]string {
+	if len(v.variableMap) == 0 {
+		return nil
+	}
+	out := make(map[string]string, len(v.variableMap))
+	for originalName, canonicalName := range v.variableMap {
+		out[canonicalName] = originalName
+	}
+	return out
+}
+
+func canonicalVariableName(index int) string {
+	index++
+	out := make([]byte, 0, 2)
+	for index > 0 {
+		index--
+		out = append([]byte{byte('a' + (index % 26))}, out...)
+		index /= 26
+	}
+	return string(out)
+}
+
+func remapVariableInput(input []byte, variableMap map[string]string) ([]byte, error) {
+	if len(input) == 0 {
+		return input, nil
+	}
+	var variables map[string]json.RawMessage
+	if err := json.Unmarshal(input, &variables); err != nil {
+		return nil, err
+	}
+	if len(variables) == 0 {
+		return input, nil
+	}
+	remapped := make(map[string]json.RawMessage, len(variables))
+	for name, value := range variables {
+		if canonicalName, ok := variableMap[name]; ok {
+			remapped[canonicalName] = value
+			continue
+		}
+		remapped[name] = value
+	}
+	return json.Marshal(remapped)
+}
diff --git a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/v2/pkg/variablesvalidation/variablesvalidation.go b/app/v2/pkg/variablesvalidation/variablesvalidation.go
index 6410033..852cb72 100644
--- a/tmp/agent-patch-flux-pr-1034.1-of-1.2026-02-28__13-38-10__gpt-5-4/app/v2/pkg/variablesvalidation/variablesvalidation.go
+++ b/app/v2/pkg/variablesvalidation/variablesvalidation.go
@@ -66,6 +66,7 @@ type VariablesValidator struct {
 type VariablesValidatorOptions struct {
 	ApolloCompatibilityFlags        apollocompatibility.Flags
 	DisableExposingVariablesContent bool
+	VariableNameLookup              func(name string) string
 }
 
 func NewVariablesValidator(options VariablesValidatorOptions) *VariablesValidator {
@@ -106,6 +107,7 @@ type variablesVisitor struct {
 	currentVariableValue *astjson.Value
 	path                 []pathItem
 	opts                 VariablesValidatorOptions
+	displayVariableName  []byte
 }
 
 func (v *variablesVisitor) renderPath() string {
@@ -158,12 +160,17 @@ func (v *variablesVisitor) popPath() {
 func (v *variablesVisitor) EnterVariableDefinition(ref int) {
 	varTypeRef := v.operation.VariableDefinitions[ref].Type
 	varName := v.operation.VariableValueNameBytes(v.operation.VariableDefinitions[ref].VariableValue.Ref)
+	displayName := varName
+	if v.opts.VariableNameLookup != nil {
+		displayName = []byte(v.opts.VariableNameLookup(unsafebytes.BytesToString(varName)))
+	}
 
 	value := v.variables.Get(unsafebytes.BytesToString(varName))
 
 	v.path = v.path[:0]
-	v.pushObjectPath(varName)
+	v.pushObjectPath(displayName)
 	v.currentVariableName = varName
+	v.displayVariableName = displayName
 	v.currentVariableValue = value
 
 	v.traverseOperationType(value, varTypeRef)
@@ -173,12 +180,12 @@ func (v *variablesVisitor) traverseOperationType(jsonValue *astjson.Value, opera
 	varTypeName := v.operation.ResolveTypeNameBytes(operationTypeRef)
 	if v.operation.TypeIsNonNull(operationTypeRef) {
 		if jsonValue == nil {
-			v.renderVariableRequiredError(v.currentVariableName, operationTypeRef)
+			v.renderVariableRequiredError(v.displayVariableName, operationTypeRef)
 			return
 		}
 
 		if jsonValue.Type() == astjson.TypeNull && varTypeName.String() != "Upload" {
-			v.renderVariableInvalidNullError(v.currentVariableName, operationTypeRef)
+			v.renderVariableInvalidNullError(operationTypeRef)
 			return
 		}
 
@@ -220,7 +227,7 @@ func (v *variablesVisitor) renderVariableRequiredError(variableName []byte, type
 
 func (v *variablesVisitor) renderVariableInvalidObjectTypeError(typeName []byte, variablesNode *astjson.Value) {
 	variableContent := string(variablesNode.MarshalTo(nil))
-	v.err = v.newInvalidVariableError(fmt.Sprintf(`%s; Expected type "%s" to be an object.`, v.invalidValueMessage(string(v.currentVariableName), variableContent), string(typeName)))
+	v.err = v.newInvalidVariableError(fmt.Sprintf(`%s; Expected type "%s" to be an object.`, v.invalidValueMessage(string(v.displayVariableName), variableContent), string(typeName)))
 }
 
 func (v *variablesVisitor) renderVariableRequiredNotProvidedError(fieldName []byte, typeRef int) {
@@ -231,11 +238,11 @@ func (v *variablesVisitor) renderVariableRequiredNotProvidedError(fieldName []by
 		v.err = err
 		return
 	}
-	v.err = v.newInvalidVariableError(fmt.Sprintf(`%s; Field "%s" of required type "%s" was not provided.`, v.invalidValueMessage(string(v.currentVariableName), variableContent), string(fieldName), out.String()))
+	v.err = v.newInvalidVariableError(fmt.Sprintf(`%s; Field "%s" of required type "%s" was not provided.`, v.invalidValueMessage(string(v.displayVariableName), variableContent), string(fieldName), out.String()))
 }
 
 func (v *variablesVisitor) renderVariableInvalidNestedTypeError(jsonValue *astjson.Value, expectedType ast.NodeKind, expectedTypeName []byte, expectedList bool) {
-	variableName := string(v.currentVariableName)
+	variableName := string(v.displayVariableName)
 	typeName := string(expectedTypeName)
 	invalidValue := string(jsonValue.MarshalTo(nil))
 	var path string
@@ -270,14 +277,14 @@ func (v *variablesVisitor) renderVariableInvalidNestedTypeError(jsonValue *astjs
 }
 
 func (v *variablesVisitor) renderVariableFieldNotDefinedError(fieldName []byte, typeName []byte) {
-	variableName := string(v.currentVariableName)
+	variableName := string(v.displayVariableName)
 	invalidValue := string(v.currentVariableValue.MarshalTo(nil))
 	path := v.renderPath()
 	v.err = v.newInvalidVariableError(fmt.Sprintf(`%s at "%s"; Field "%s" is not defined by type "%s".`, v.invalidValueMessage(variableName, invalidValue), path, string(fieldName), string(typeName)))
 }
 
 func (v *variablesVisitor) renderVariableEnumValueDoesNotExistError(typeName []byte, enumValue []byte) {
-	variableName := string(v.currentVariableName)
+	variableName := string(v.displayVariableName)
 	invalidValue := string(v.currentVariableValue.MarshalTo(nil))
 	var path string
 	if len(v.path) > 1 {
@@ -286,7 +293,7 @@ func (v *variablesVisitor) renderVariableEnumValueDoesNotExistError(typeName []b
 	v.err = v.newInvalidVariableError(fmt.Sprintf(`%s%s; Value %sdoes not exist in "%s" enum.`, v.invalidValueMessage(variableName, invalidValue), path, v.invalidEnumValueIfAllowed(string(enumValue)), string(typeName)))
 }
 
-func (v *variablesVisitor) renderVariableInvalidNullError(variableName []byte, typeRef int) {
+func (v *variablesVisitor) renderVariableInvalidNullError(typeRef int) {
 	buf := &bytes.Buffer{}
 	err := v.operation.PrintType(typeRef, buf)
 	if err != nil {
@@ -294,7 +301,7 @@ func (v *variablesVisitor) renderVariableInvalidNullError(variableName []byte, t
 		return
 	}
 	typeName := buf.String()
-	v.err = v.newInvalidVariableError(fmt.Sprintf(`Variable "$%s" got invalid value null; Expected non-nullable type "%s" not to be null.`, string(variableName), typeName))
+	v.err = v.newInvalidVariableError(fmt.Sprintf(`Variable "$%s" got invalid value null; Expected non-nullable type "%s" not to be null.`, string(v.displayVariableName), typeName))
 }
 
 func (v *variablesVisitor) traverseFieldDefinitionType(fieldTypeDefinitionNodeKind ast.NodeKind, fieldName ast.ByteSlice, jsonValue *astjson.Value, typeRef, inputFieldRef int) {