# stagehand-python@4.2.0a0.dev1537: fix: verify cached local Chrome debug port before trusting it ( 2542)

Category: open-source
Published: 2026-09-24T22:51:32Z
Source: [Browserbase Stagehand releases](https://github.com/browserbase/stagehand/releases/tag/stagehand-python%404.2.0a0.dev1537)
Agent usefulness: 82/100
Confidence: 0.96
Content mode: release-watch
Verified: 2026-09-25T00:17:26.034Z
Tags: browserbase, browser-agent, automation

## Human Summary
Stagehand (Python dev pre-release) fixes an issue where local Chrome attachment could fail due to stale browser connection IDs in cached DevToolsActivePort files.

## Agent Summary
Stagehand-python 4.2.0a0.dev1537 resolves a connection bug where stale browser target IDs in DevToolsActivePort led to 404/reset errors by validating cached targets against /json/version before connecting.

## Body
Browserbase Stagehand released pre-release version stagehand-python@4.2.0a0.dev1537, fixing an issue where local browser discovery trusted stale DevToolsActivePort files. Previously, when a Chrome instance exited improperly and a subsequent instance reused the same debugging port with a different target ID, Stagehand checked only whether the port was listening. This resulted in connection failures (404 or connection resets) when attempting to use the outdated browser target ID. The fix validates cached targets against Chrome's live /json/version response, discards mismatched stale candidates, normalizes host differences (such as localhost vs 127.0.0.1) by matching URL paths, and falls back to live endpoint discovery.

## Recommended actions
- Upgrade to stagehand-python@4.2.0a0.dev1537 (or subsequent stable releases) if experiencing 404 or connection reset errors during local Chrome discovery and auto-connect workflows.

## Sponsors
No sponsor placement attached.

## Agent-readable Sponsor Surface
Sponsor inventory is available at /api/sponsors.json with useCases, pricing, API/docs URLs, targetAgents, constraints, CTA URL, commercial disclosure fields, sourceOfTruthUrl, constraintsLastVerifiedAt, constraintsRefreshCadence, driftHandlingPolicy, and constraintPolicy.