louislam/uptime-kuma · error · Error

Unsupported proxy protocol provided. ${proxy.protocol}

Error message

Unsupported proxy protocol provided. ${proxy.protocol}

What it means

Thrown by Proxy.createAgents in the default branch of the protocol switch. This is a defensive guard reached only if proxy.protocol is not http/https/socks/socks5/socks5h/socks4 at agent-construction time. Because Proxy.save already validates protocol against SUPPORTED_PROXY_PROTOCOLS (and the switch covers all of them), reaching this branch implies the bean's protocol was mutated after saving, loaded from a legacy/partial DB row, or created by code that bypassed save().

Source

Thrown at server/proxy.js:151

            case "socks5":
            case "socks5h":
            case "socks4":
                // eslint-disable-next-line no-case-declarations
                const SocksCookieProxyAgent = createCookieAgent(SocksProxyAgent);
                agent = new SocksCookieProxyAgent(proxyUrl.toString(), {
                    ...httpAgentOptions,
                    ...httpsAgentOptions,
                    tls: {
                        rejectUnauthorized: httpsAgentOptions.rejectUnauthorized,
                    },
                });

                httpAgent = agent;
                httpsAgent = agent;
                break;

            default:
                throw new Error(`Unsupported proxy protocol provided. ${proxy.protocol}`);
        }

        return {
            httpAgent,
            httpsAgent,
        };
    }

    /**
     * Reload proxy settings for current monitors
     * @returns {Promise<void>}
     */
    static async reloadProxy() {
        const server = UptimeKumaServer.getInstance();

        let updatedList = await R.getAssoc("SELECT id, proxy_id FROM monitor");

        for (let monitorID in server.monitorList) {

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Inspect the proxy row in the DB (SELECT id, protocol FROM proxy) and correct any non-canonical value to one of http/https/socks/socks5/socks5h/socks4.
  2. If the protocol is null, re-save the proxy through the UI to run validation and populate the field.
  3. Ensure no external script writes to the proxy table without going through Proxy.save.
  4. As defense-in-depth, call Proxy.save's validation before createAgents, or normalize the protocol at agent-build time.

Example fix

// before
switch (proxy.protocol) {
    case "http": /*...*/ break;
    case "socks": /*...*/ break;
    default:
        throw new Error(`Unsupported proxy protocol provided. ${proxy.protocol}`);
}
// after (fail fast with the supported list so the operator knows what to fix)
const protocol = (proxy.protocol || "").toLowerCase();
if (!Proxy.SUPPORTED_PROXY_PROTOCOLS.includes(protocol)) {
    throw new Error(`Unsupported proxy protocol "${protocol}". Supported: ${Proxy.SUPPORTED_PROXY_PROTOCOLS.join(", ")}`);
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate protocol immediately before building agents
const protocol = (proxy.protocol || "").toLowerCase();
if (!Proxy.SUPPORTED_PROXY_PROTOCOLS.includes(protocol)) {
    throw new Error(`Unsupported proxy protocol "${protocol}". Supported: ${Proxy.SUPPORTED_PROXY_PROTOCOLS.join(", ")}`);
}

Type guard

/** True when the bean protocol is one createAgents can handle. */
function isAgentCompatibleProtocol(protocol) {
    return typeof protocol === "string" &&
        ["http","https","socks","socks5","socks5h","socks4"].includes(protocol.toLowerCase());
}

Try / catch

if (!isAgentCompatibleProtocol(proxy.protocol)) {
    throw new Error(`Unsupported proxy protocol provided. ${proxy.protocol}`);
}
// ...switch (proxy.protocol) { ... }

Prevention

When it happens

Trigger: A monitor loads a proxy bean whose protocol field is null/empty/unknown (legacy DB row from before validation existed), an external process inserted a proxy row directly into the DB with an invalid protocol, or upstream save() validation was bypassed.

Common situations: Old DB row predating the SUPPORTED_PROXY_PROTOCOLS check, direct SQL insert with a bad protocol, or schema drift after a partial migration.

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/f721e1644ea21a43. Report an issue: GitHub.