Skip to content

Evaluation CSV cannot recognize a BOM-prefixed audio header #288

Backlog

Description

@codebanditssss

What happens

assembly eval rejects a valid UTF-8 CSV manifest when the file starts with a byte-order mark (BOM, EF BB BF). Excel's "CSV UTF-8" export and several other tools write this BOM. Both automatic column detection and an explicit --audio-column audio fail with exit code 2 before any transcription. The same CSV without the BOM evaluates normally.

Tested on CLI main a4a7760ad7925f5feb1f4776d56b5ffd299f3d54, Linux, Python 3.13.14. The actual assembly console entry point was run against a real local WAV file. A fake API key was used, and the SDK transcription boundary was stubbed in-process, so nothing left the machine.

Command Exit Output
assembly eval calls_bom.csv --json 2 Could not find an audio column (columns: \ufeffaudio, text).
assembly eval calls_bom.csv --audio-column audio --json 2 The dataset has no 'audio' column (columns: \ufeffaudio, text).
assembly eval calls_nobom.csv --json (same bytes without the BOM) 0 WER payload produced

Neither BOM run reached the transcription boundary. The invisible \ufeff makes the error confusing, because the column list appears to contain audio.

Reproduction (from the repository root, no API key needed)

mkdir -p /tmp/aai-bom && cd /tmp/aai-bom
python3 -c "import wave; w=wave.open('call-001.wav','wb'); w.setnchannels(1); w.setsampwidth(2); w.setframerate(16000); w.writeframes(b'\0\0'*1600); w.close()"
printf '\xef\xbb\xbfaudio,text\ncall-001.wav,hello world\n' > calls_bom.csv
printf 'audio,text\ncall-001.wav,hello world\n' > calls_nobom.csv
cd -

Save as /tmp/repro_eval.py:

import sys
from types import SimpleNamespace

from typer.testing import CliRunner

from aai_cli.core import client
from aai_cli.main import app

client.transcribe = lambda api_key, audio, *, config: SimpleNamespace(text="hello world")
result = CliRunner().invoke(app, ["eval", *sys.argv[1:], "--json"])
print(result.exit_code)
print(result.output)
export ASSEMBLYAI_API_KEY=fake-not-a-real-key AAI_TELEMETRY_DISABLED=1 \
  XDG_CONFIG_HOME="$(mktemp -d)"
uv run python /tmp/repro_eval.py /tmp/aai-bom/calls_bom.csv                        # exit 2
uv run python /tmp/repro_eval.py /tmp/aai-bom/calls_bom.csv --audio-column audio   # exit 2
uv run python /tmp/repro_eval.py /tmp/aai-bom/calls_nobom.csv                      # exit 0, WER 0.0

Note: credentials are resolved before the dataset is loaded. Without ASSEMBLYAI_API_KEY, the command exits with not_authenticated before it reaches this bug.

Cause

_manifest_rows opens CSV manifests with encoding="utf-8", which keeps the BOM as a \ufeff character at the start of the first header. csv.DictReader then reports the first column as \ufeffaudio, so the exact-name lookup in _pick_column cannot find audio. Passing the literal --audio-column $'\ufeffaudio' works, which confirms that header decoding is the cause.

Opening the file with encoding="utf-8-sig" strips a leading BOM and decodes BOM-less UTF-8 the same way as before.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions