# FindProxyForURL declared more than once

Source: https://findproxyforurl.net/rules/duplicate-findproxyforurl/ · last updated 2026-10-04

Rule PAC-E003 (`duplicate-findproxyforurl`), severity high, category: Errors and robustness.

Two or more function declarations named FindProxyForURL. JavaScript keeps the last one; the others are dead code that still looks authoritative to a reader.

## Why it matters

Function declarations are hoisted and later declarations overwrite earlier ones. When a
PAC contains two `FindProxyForURL` bodies (usually after merging two files or keeping an
old version "for reference"), the engine runs only the last one. Whoever edits the first
body sees no effect and may conclude the PAC is broken or cached.


## How to fix

Keep exactly one FindProxyForURL; move alternative versions out of the file or into version control.

## Bad

```js
function FindProxyForURL(url, host) {
  return "PROXY old-proxy.corp.example:8080";
}
function FindProxyForURL(url, host) {
  return "PROXY proxy.corp.example:8080";
}
```

## Good

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