{"record":{"id":"ea23711bcd37c7c3","repo":"emberjs/ember.js","slug":"gt-expects-exactly-two-arguments-but-received","errorCode":null,"errorMessage":"`gt` expects exactly two arguments, but received ${arguments.length}.","messagePattern":"`gt` expects exactly two arguments, but received (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@glimmer/runtime/lib/helpers/gt.ts","lineNumber":10,"sourceCode":"import { DEBUG } from '@glimmer/env';\n\n/**\n * Performs a greater than comparison.\n *\n * left > right\n */\nexport function gt<T>(left: T, right: T) {\n  if (DEBUG && arguments.length !== 2) {\n    throw new Error(`\\`gt\\` expects exactly two arguments, but received ${arguments.length}.`);\n  }\n\n  return (left as number) > (right as number);\n}\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/runtime/lib/helpers/gt.ts#L1-L15","documentation":"The `gt` helper performs a greater-than comparison (left > right) in templates. A debug-only arity guard throws when the helper receives an argument count other than exactly two, which arises from direct JS invocation or a malformed wrapper rather than normal template use of `{{gt a b}}`.","triggerScenarios":"Calling `gt()` directly from JS with 1 or 3+ arguments; a custom helper forwarding positional args incorrectly; programmatic invocation missing the two required positional arguments.","commonSituations":"Test code calling the internal helper directly; refactoring a template comparison into JS; curry/wrapper utilities dropping or duplicating arguments.","solutions":["Use `{{gt a b}}` in templates with exactly two arguments","When calling from JS, pass exactly two arguments: `gt(a, b)`","Fix wrappers to assert `positional.length === 2` before delegating"],"exampleFix":"// before\ngt(count);\n// after\ngt(count, 10);","handlingStrategy":"validation","validationCode":"function safeGt(...args) { if (args.length !== 2) throw new TypeError('gt requires exactly two arguments'); return gt(args[0], args[1]); }","typeGuard":"function hasTwoArgs<T extends unknown[]>(args: T): args is T & { length: 2 } { return args.length === 2; }","tryCatchPattern":"try { result = gt(a, b); } catch (e) { console.error('gt arity error:', e.message); result = false; }","preventionTips":["Always call gt from templates with exactly two arguments","Count arguments before calling from JS","Assert positional.length in wrapper helpers"],"tags":["glimmer","template-helper","arity","debug"],"backgroundTag":"helper-arity-mismatch","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}