# agent csv parse failed on nested quotes in questionnaire: how to fix it

Nested quotes inside quoted CSV fields break naive parsers the agent shells out to. Preprocess the file to escape inner quotes consistently, then parse, and validate row counts before trusting the output.

```text
agent csv parse failed on nested quotes in questionnaire
```

## When to use this skill
- Agent misparses questionnaire CSV rows
- Parsed answers land in the wrong columns

## When not to use this skill
- Human import of the same file works (a parser-choice issue)
- File fails on encoding (a character-set issue)

## Tool compatibility
Agent CSV parsing for questionnaires. Related area: data pipelines and agent tooling.

Related area: proposal automation and agent-assisted RFP workflows.

Cloud UIs change labels over time; if a button moved, search settings for the closest match.

## Before you start
- Sign in to the tool and keep one tab open so sessions stay clean
- Copy the exact error text and note the time it happened
- Set aside 15 to 20 minutes; most of these resolve in a single pass

## Quick diagnosis
Make sure this is the right skill before you invest the 15 minutes.
- If you are dealing with agent misparses questionnaire CSV rows, start at step 1 below.
- If instead human import of the same file works (a parser-choice issue), stop here; you need a different skill.
- If neither quite matches, compare your screen against the verbatim error block at the top; that block is exactly what this skill covers.

## Fix it in steps
### 1. Count rows before parsing

```
Count the data rows in the raw file with a line counter.
```
Expected: Expected: you know the expected row count.

### 2. Normalize inner quotes

```
Replace inner quotes with doubled quotes so quoting is consistent.
```
Expected: Expected: every quoted field uses one consistent style.

### 3. Parse with a strict CSV reader

```
Use a real CSV parser, not string splitting on commas.
```
Expected: Expected: rows parse without column shifts.

### 4. Validate the row count after

```
Compare parsed rows against the raw count.
```
Expected: Expected: counts match; no rows merged or split.

## Confirm each step worked
Run through this checklist before moving on. If a check fails, redo that step instead of pushing ahead.
- Step 1 (count rows before parsing): Expected: expected: you know the expected row count.
- Step 2 (normalize inner quotes): Expected: expected: every quoted field uses one consistent style.
- Step 3 (parse with a strict CSV reader): Expected: expected: rows parse without column shifts.
- Step 4 (validate the row count after): Expected: expected: counts match; no rows merged or split.

## Quick recap
1. Count rows before parsing
2. Normalize inner quotes
3. Parse with a strict CSV reader
4. Validate the row count after

## Still stuck?
Gather three things: the exact error text, the time it happened, and what changed just before it broke.
Check the vendor status page for an active incident. Then open a support ticket with those three things;
it cuts the back-and-forth in half. For agent runs, attach the last 50 lines of the agent log too,
since the loop or timeout signature in the log usually names the cause.

## Variant phrasings
### agent csv nested quotes failed
Normalize quoting first. If this matches what you saw, the steps above apply as written.

### agent questionnaire csv parse error
Strict parser plus validation fixes it. If this matches what you saw, the steps above apply as written.

## Why it happens
Agents often reach for quick string splitting, which cannot handle quotes inside quotes. A strict parser plus a before and after row count turns silent corruption into a loud, catchable error.

## Edge cases
- Validate row counts on every agent CSV parse; it is the cheapest correctness check
- Quoted newlines inside answers break line-based counting; count with the parser
- Keep the raw file; reprocessing beats re-asking the source

## Provenance

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