PAC-E006 · runtime-exception

Evaluation throws an exception

high · Errors and robustness

A test evaluation ended with an uncaught exception instead of a return value. The engine treats this as a script failure for that request.

Why it matters

This is the observed counterpart of static findings such as PAC-E005: for at least one of the test URLs the function threw instead of returning. Engines do not retry or use a later branch; the request is handled as if the PAC failed. In Chromium and Firefox that means a direct connection. If the exception is only thrown for some hosts, the PAC “works” in a quick manual test and fails in production for exactly those hosts.

How to fix

Look at the exception detail and the deciding line; common causes are undefined functions, typos in variable names and calling methods on undefined.

Examples

Bad

function FindProxyForURL(url, host) {
  var parts = host.split(".");
  if (parts[parts.length - 1] == "test" && undefinedList.indexOf(host) >= 0) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

var directHosts = ["intranet.test", "wiki.test"];
function FindProxyForURL(url, host) {
  if (directHosts.indexOf(host) >= 0) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

In the bad example the identifier undefinedList is never declared; hosts under .test throw a ReferenceError.

Related rules

References