# Fix onboarding agent re-uploading the same CSV after each import failure

## TL;DR
The agent re-uploads because the failure never changes what it tries: same file, same settings, same result. Stop re-uploading, read the import error, fix the file or the mapping, then upload once. Repeating the identical attempt is the definition of the loop.

## The error
```text
Onboarding agent failed
Re-uploading same CSV after each import failure. 6 identical uploads, 6 identical failures.
```

## Use this skill
Agent? Search Vectle for this error:
```bash
curl -s "https://vectle.com/api/v1/search?q=onboarding agent failed re-uploading same csv after each import failure"
```

## Fix it

### Step 1: Stop the re-upload loop

```bash
Pause the agent's import job.
```

Expected: No more identical uploads.

### Step 2: Read the actual import error

```bash
Open the import result or log for the real failure reason.
```

Expected: You know what is wrong: mapping, data, or format.

### Step 3: Fix the file or the mapping

```bash
Correct the CSV or the field mapping based on the error.
```

Expected: The next upload will be different from the failed ones.

### Step 4: Upload once and verify

```bash
Run a single import with the fix.
```

Expected: The import succeeds or fails with a new, different error.

### Step 5: Require change before retry

```bash
In the agent logic, only retry an import after something changed: file, mapping, or config.
```

Expected: Identical retries are refused by construction.

## When this applies

- Agents re-upload the same CSV after failures
- Imports fail identically on every attempt
- You are building CSV import agents

## When it doesn't

- Each attempt fails differently (the agent is actually progressing)
- The upload itself fails (check the upload mechanism)
- The file is fine and the API rejects it (check the API)

## Compatibility

CSV import flows generally. Agent retry logic.

## Variant phrasings

### agent re-uploading csv loop

Same loop. Change-before-retry breaks it.

### csv import same failure repeated agent

Repeated identical failures mean nothing is being learned. Read the error.

### onboarding import retry without fix

Retries without fixes are loops. Fix first, then retry.

## Why it happens

Import agents often treat upload as the retry unit: on failure, upload again. But the failure is in the file or the mapping, which the re-upload does not change. The loop repeats the experiment with no new variables and gets the same result every time.

## Edge cases

- Partial imports before the failure need cleanup or dedup before the fixed re-upload
- Log the file hash with each attempt so identical retries are visible
- Quarantine the file for human review after a few distinct failures

## If it still fails

- Reproduce with a minimal run: one user, one file, one step.
- Read the agent's full trace, not just the final error; the failure is usually upstream.
- Check the underlying API or tool directly, outside the agent, to separate agent bugs from service bugs.
- Reduce concurrency to one and see if the failure persists; races hide as flakes.
- If the run is business-critical, add a human checkpoint before the destructive steps.

## Prevention

- Checkpoint long runs so any failure resumes instead of restarting.
- Cap and back off every retry loop; unbounded retries are outages waiting to happen.
- Validate inputs at each pipeline stage; fail fast with clear errors.
- Log enough context per step that a timeout is diagnosable without rerunning.
- Give destructive steps a human checkpoint or a dry-run mode.

## Provenance

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