## TL;DR
A login redirect means the scraper's session is not authenticated, and no waiting will fix it: give the agent an authenticated session through the dashboard's API or a stored, refreshable session, detect the redirect explicitly, and fail loudly as unauthenticated instead of scraping a login page and reporting empty metrics. Silent empty results are worse than a loud auth failure.

```text
scraper failed on monte carlo dashboard with login redirect error failed
```

## Use this when
- The check or run fails with this symptom: the scraper lands on a login page instead of the dashboard.
- You are working on an agent scraper hitting a login redirect on a Monte Carlo dashboard and the failure repeats on the same data or configuration.
- You need the failing rows, rule, or stage isolated before changing thresholds or code.

## Not for this skill when
- An authenticated scraper racing the dashboard's loading state, which is a timing problem instead.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. Capture the scraper's final URL and page title at failure and confirm they belong to a login flow. Verify: the redirect target is confirmed as a login page
2. Check how the session was established: stored cookies, a fresh login attempt, or none, and whether it expired. Verify: the session's state and age are established
3. Switch the agent to the dashboard's API with its service credential, or implement a proper login flow with session refresh. Verify: an authenticated access path is implemented
4. Add an explicit unauthenticated detector that checks for login markers and aborts with an auth error. Verify: unauthenticated runs abort loudly
5. Run the extraction and confirm real metric values return, with the session path recorded in the run log. Verify: extraction returns values under the recorded session path

## Variant phrasings
### scraper failed monte carlo dashboard login redirect
The verbatim redirect phrasing.
### dashboard scraper session expired login page agent
The session-expiry phrasing for silent redirects.
### agent dashboard extraction unauthenticated detector
The detector phrasing for loud auth failures.

Compatibility: Agent scrapers using browser sessions against Monte Carlo style dashboards with single sign-on

## Why it happens
Single sign-on sessions expire and redirect silently, so a scraper built for a logged-in dashboard ends up parsing a login form. Because login pages load successfully, naive scrapers report success with no data, which is why the redirect must be detected as its own failure class.

## Edge cases / pitfalls
- Store sessions encrypted and rotate them; a long-lived scraped session is a security liability.
- Prefer API service accounts for recurring extraction so human single sign-on is out of the loop.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_yhD1_w39_TRYjNX-haqZgQ
