# Call to a function that is not defined

Source: https://findproxyforurl.net/rules/unknown-function-call/ · last updated 2026-10-04

Rule PAC-E005 (`unknown-function-call`), severity critical, category: Errors and robustness.

The function name is neither a PAC helper, an ES5 global, nor defined in the file. The branch throws when reached and the engine treats the request as a script failure.

## Why it matters

A misspelt helper (`isInNetwork`, `dnsdomainIs`, `ShExpMatch`) parses fine and only fails
when that line is executed. The thrown `ReferenceError` aborts the whole evaluation, so
the deliberate default route at the end of the function is never reached. Chromium records
a PAC script error and falls back to DIRECT for that request; other engines also do not
apply the intended proxy. Because the failure is per request and per code path, desk
tests that never hit the branch pass.

Ex-functions (`isInNetEx`, `dnsResolveEx`, ...) are defined only in some engines and are
reported separately by PAC-K003.


## How to fix

Correct the spelling (PAC helpers are case-sensitive) or define the helper function in the file.

## Bad

```js
function FindProxyForURL(url, host) {
  if (isInNetwork(host, "10.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Good

```js
function FindProxyForURL(url, host) {
  if (isInNet(host, "10.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Engine behaviour

- chromium: An exception inside FindProxyForURL fails the evaluation (ERR_PAC_SCRIPT_FAILED); the request falls back to DIRECT unless ProxyPacMandatory is set. (source: code, verified 2026-10-04)
