ReferenceError when running Scorer

Last updated: February 28, 2026

This issue is applicable to customers matching these conditions

Plans: Any

Deployments: Any

Use case: Code scorers in the UI

Issue

While running a Scorer, you notice ReferenceError: handler is not defined

in UI.

Cause

The UI code scorer runtime requires the function to be named exactly handler.

Resolution

Update your scorer function name to handler:

Typescript Example

function handler({
  input,
  output,
  expected,
  metadata,
}: {
  input: any;
  output: any;
  expected: any;
  metadata: Record<string, any>;
}): number | null {
  if (expected === null) return null;
  return output === expected ? 1 : 0;
}

Python Example

def handler(input, output, expected, metadata):
    if expected is None:
        return None
    return 1 if output == expected else 0