gchq/CyberChef · error · OperationError

${error.toString()} This error could be caused by one of th

Error message

${error.toString()}

This error could be caused by one of the following:
 - An invalid Resolver URL

What it means

Thrown by DNS over HTTPS run() when `new URL(resolver)` raises - i.e. the Resolver argument is not a parseable absolute URL. The original TypeError from the URL constructor is stringified and re-wrapped as an OperationError with a hint. This fires synchronously before any network call.

Source

Thrown at src/core/operations/DNSOverHTTPS.mjs:101

                name: "Disable DNSSEC validation",
                type: "boolean",
                value: false
            }
        ];
    }

    /**
     * @param {string} input
     * @param {Object[]} args
     * @returns {JSON}
     */
    run(input, args) {
        const [resolver, requestType, justAnswer, DNSSEC] = args;
        let url = URL;
        try {
            url = new URL(resolver);
        } catch (error) {
            throw new OperationError(error.toString() +
            "\n\nThis error could be caused by one of the following:\n" +
            " - An invalid Resolver URL\n");
        }
        const params = {name: input, type: requestType, cd: DNSSEC};

        url.search = new URLSearchParams(params);

        return fetch(url, {headers: {"accept": "application/dns-json"}}).then(response => {
            return response.json();
        }).then(data => {
            if (justAnswer) {
                return extractData(data.Answer);
            }
            return data;
        }).catch(e => {
            throw new OperationError(`Error making request to ${url}\n${e.toString()}`);
        });

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Use the full absolute URL including scheme, e.g. 'https://cloudflare-dns.com/dns-query' or 'https://dns.google.com/resolve'.
  2. If adding a custom DoH endpoint, ensure it accepts GET with name= and type= query parameters and returns application/dns-json.
  3. Restore one of the built-in Google/Cloudflare defaults.
  4. Check for stray whitespace or object-stringified values in the Resolver field.

Example fix

// before
Resolver: cloudflare-dns.com/dns-query

// after
Resolver: https://cloudflare-dns.com/dns-query
Defensive patterns

Strategy: validation

Validate before calling

function isValidResolverUrl(resolver) {
    try {
        const u = new URL(resolver);
        return u.protocol === "http:" || u.protocol === "https:";
    } catch {
        return false;
    }
}

Type guard

/** @returns {boolean} */
function isAbsoluteHttpUrl(s) {
    try {
        const u = new URL(String(s));
        return u.protocol === "http:" || u.protocol === "https:";
    } catch {
        return false;
    }
}

Try / catch

try {
    result = await dnsOverHttps.run(input, args);
} catch (e) {
    if (e instanceof OperationError && /invalid Resolver URL|TypeError: Invalid URL/i.test(e.message)) {
        // prompt user to enter a valid https:// resolver URL
    } else throw e;
}

Prevention

When it happens

Trigger: Resolver set to a value that is not a valid absolute URL: missing scheme (e.g. 'cloudflare-dns.com/dns-query'), a relative path, 'undefined'/'[object Object]' from a malformed option value, or a typo. The editableOption default values are valid, so this typically requires the user to edit/add a custom resolver.

Common situations: Typing a resolver without the https:// scheme; pasting a domain-only resolver; a custom resolver value that was constructed from an object instead of a string; deleting the resolver field.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/3f64c5f7dc9fa716. Report an issue: GitHub.