## TL;DR
An Airflow run that loses its credential mid-DAG fails the current task and marks downstream tasks skipped, so the agent's job is recovery, not just reporting: refresh the credential in the Airflow connection, clear the failed task and its downstream, and let the DAG rerun from the failure point. The agent should verify the connection works before clearing anything, or the rerun fails at the same task.

```text
auth token expired mid-airflow data quality dag run error failed
```

## Use this when
- The check or run fails with this symptom: the Airflow data quality DAG fails mid-run with an authentication error.
- You are working on an agent-managed Airflow data quality DAG failing on an expired credential 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
- A DAG failing on a data error in a task, where the credential is fine and the task logic needs the fix instead.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. Open the failed task's log and confirm the authentication error and the exact task where the run stopped. Verify: the stopping task and error are confirmed
2. Identify the Airflow connection the task uses and test it after refreshing the credential it stores. Verify: the refreshed connection tests successfully
3. Check whether other DAGs share the same connection, since they will fail next if it is not fixed centrally. Verify: shared-connection DAGs are listed
4. Clear the failed task and its downstream tasks in the DAG run so execution resumes from the failure point. Verify: the DAG run is cleared from the failure point
5. Watch the rerun pass the previously failing task and complete, and record the credential's rotation date for the next cycle. Verify: the rerun completes and the rotation is scheduled

## Variant phrasings
### auth expired mid airflow data quality dag run
The verbatim Airflow expiry phrasing, with the credential named generically.
### airflow connection credential expired task failed clear rerun
The recovery phrasing for clearing from the failure point.
### airflow dag authentication failed shared connection
The shared-connection phrasing for central fixes.

Compatibility: Airflow DAGs for data quality driven or monitored by an agent, with provider credentials

## Why it happens
Airflow centralises credentials in connections that many tasks and DAGs share, so one expiry cascades across a run and across schedules. The task log shows the symptom; the connection is the shared point of failure and of repair.

## Edge cases / pitfalls
- Move long-lived Airflow connections to a secrets backend with rotation so expiry stops being a calendar event.
- Alert on connection test failures on a schedule, before a DAG discovers them at run time.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_w9Wibrvhkwz16gFDHMU6Zw
