Skip to content

CLI: audit fails 'Cannot reach … ECONNRESET' on sites that reset browser-like clients; probe ignores [crawler] user_agent #2140

Closed

Description

@nc9

What happens

squirrel audit https://example.site/ fails before crawling with:

Cannot reach https://example.site/: ECONNRESET: The socket connection was closed unexpectedly. ...
No audit ran and there is no score.

The site works in a browser and answers curl with a 200. A new user hit this on 11-19 five times in eight minutes on their own site, so it's their first experience of the CLI.

Why

Some servers (here an nginx with a bot filter) reset any connection whose request claims to be Chrome but whose TLS handshake isn't Chrome's. Reproduced with Bun against the affected site:

User-Agent sent Result
Chrome UA + sec-ch-ua headers (what the CLI sends) ECONNRESET
Chrome UA only ECONNRESET
SquirrelScan/2.0 (+https://squirrelscan.com) 200

curl shows the same split (HTTP/2 PROTOCOL_ERROR with a Chrome UA, 200 with curl's default or ours).

Two things in the CLI make this unrecoverable:

  1. The reachability probe (apps/cli/src/utils/reachability.ts → requestOnceScoped) always sends CHROME_USER_AGENT plus sec-ch-ua headers (tools/request.ts default config). initRequestTool in controllers/audit.ts only sets the timeout, so a [crawler] user_agent in squirrel.toml never reaches the probe. A user cannot work around it.
  2. ECONNRESET is retried as transient (3 attempts) with the same headers, so it fails the same way three times.

Acceptance Criteria

  • The reachability probe sends the same User-Agent the crawl will use: the configured [crawler] user_agent when set, otherwise the project's pinned UA.
  • When the probe's browser-UA attempts end in a connection reset (or an HTTP/2 protocol error) and the honest SquirrelScan/… UA gets an answer, the audit continues with the honest UA for the whole crawl. It says so in one line of output and in the report, so the user knows the site filters browser-like clients.
  • With [crawler] user_agent set, a site that resets browser UAs is audited (no probe failure).
  • The unreachable message for a reset names the likely cause and the fix ("the site reset the connection; it may block browser-like clients: set [crawler] user_agent…") instead of the bare socket error.
  • Tests: a local server that resets requests carrying a Chrome UA and answers others. The probe and crawl succeed via the fallback; a configured UA is used by the probe; fail-before on current main.
  • Docs: docs/configuration/crawler.mdx user_agent section mentions this case. The agent skill's troubleshooting is checked for the same advice.

Activity

  1. added
    bug
    size: S
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions