{"record":{"id":"2bbd87019ee56047","repo":"cayleygraph/cayley","slug":"label-directive-should-have-v-argument","errorCode":null,"errorMessage":"label directive should have 'v' argument","messagePattern":"label directive should have 'v' argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"query/graphql/graphql.go","lineNumber":518,"sourceCode":"\tif fld.Alias != nil && fld.Alias.Value != \"\" {\n\t\tout.Alias = fld.Alias.Value\n\t} else {\n\t\tout.Alias = name\n\t}\n\tout.Via, out.Rev = stringToVia(name)\n\t// first check for \"label\" directive - it will affect all traversals\n\tfor _, d := range fld.Directives {\n\t\tif d.Name == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch d.Name.Value {\n\t\tcase \"label\":\n\t\t\tif len(d.Arguments) == 0 {\n\t\t\t\tout.Labels = nil\n\t\t\t} else if len(d.Arguments) > 1 {\n\t\t\t\treturn out, fmt.Errorf(\"label directive should have 0 or 1 argument\")\n\t\t\t} else if a := d.Arguments[0]; a.Name == nil || a.Name.Value != \"v\" {\n\t\t\t\treturn out, fmt.Errorf(\"label directive should have 'v' argument\")\n\t\t\t} else {\n\t\t\t\tvals, err := convValue(a.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn out, fmt.Errorf(\"error parsing label: %v\", err)\n\t\t\t\t}\n\t\t\t\tout.Labels = vals\n\t\t\t}\n\t\t}\n\t}\n\tfor _, d := range fld.Directives {\n\t\tif d.Name == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch d.Name.Value {\n\t\tcase \"rev\", \"reverse\":\n\t\t\tif len(d.Arguments) == 0 {\n\t\t\t\tout.Rev = out.Rev != true\n\t\t\t} else {","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/query/graphql/graphql.go#L500-L536","documentation":"When @label has exactly one argument, that argument must be named `v`. Any other argument name (or an unnamed/positional-looking argument) triggers this error.","triggerScenarios":"A directive like `@label(label: \"x\")` or `@label(\"x\")` parsed to an argument whose Name is nil or != \"v\" in convField.","commonSituations":"Renaming the argument for clarity; translating examples from other GraphQL dialects; typos like `@label(val: \"x\")`.","solutions":["Rename the argument to `v`: `@label(v: \"value\")`","Check the directive's documented signature and follow it","Omit arguments entirely (`@label`) to clear labels"],"exampleFix":"// before\nq := \"query { node @label(val: \"x\") { id } }\"\n// after\nq := \"query { node @label(v: \"x\") { id } }\"","handlingStrategy":"validation","validationCode":"function validateLabelArg(d) {\n  if (d.arguments.length === 1 && d.arguments[0].name?.value !== 'v') {\n    throw new Error('@label argument must be named v');\n  }\n}","typeGuard":"const isNamedV = (a) => a?.name?.value === 'v';","tryCatchPattern":null,"preventionTips":["Always name the argument v","Avoid renaming directive arguments in custom tooling","Check examples in Cayley docs for exact syntax"],"tags":["graphql","directive","invalid-argument-value"],"backgroundTag":"invalid-argument","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}