tonhowtf/omniget · warning
CSV row import errors rendered to user
Error message
CSV row import errors rendered to user: "{result.data.errors.length} linhas com erro" list What it means
Not a thrown error but UI rendering of per-row CSV import failures: the Anki CSV import result carries a data.errors array, and the page shows the count plus up to 20 individual row errors in a collapsible list.
Solutions
- Expand the errors <details> and fix the first listed rows in the source CSV
- Re-export the CSV matching the expected header/column template
- Ensure UTF-8 encoding and correct delimiter
- Re-import after correcting rows; the '… e mais N' line indicates remaining rows
Defensive patterns
Strategy: validation
Validate before calling
const rows = csv.split(/\r?\n/).slice(1).filter(r => r.trim());
const expectedCols = 3; // match import template
const bad = rows.filter(r => r.split(",").length !== expectedCols);
if (bad.length > 0) warnUserBeforeImport(bad.length); Type guard
function isCsvResult(r: ImportResult): r is { kind: "csv"; data: { errors: string[] } } {
return r.kind === "csv" && Array.isArray((r.data as { errors?: unknown }).errors);
} Try / catch
if (result.kind === "csv" && result.data.errors.length > 0) {
console.warn(`CSV import: ${result.data.errors.length} rows failed`, result.data.errors.slice(0, 20));
} Prevention
- Use the documented CSV template with exact headers
- Save CSVs as UTF-8 with the expected delimiter
- Validate a small sample file before bulk imports
- Review the errors list and fix source rows before re-import
When it happens
Trigger: Importing a CSV where some rows fail validation/mapping (missing fields, bad encoding, wrong delimiter, invalid note fields), producing result.data.errors.length > 0.
Common situations: CSV exported with different columns than the expected template, semicolon vs comma delimiters, non-UTF-8 encodings, or rows with empty required fields.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- MB não cabem s de vídeo — aumente o alvo ou encurte o clipe
- a API oficial so aceita URLs publicas (https://…) para os…
- a capa não é PNG, JPEG, GIF ou BMP
- a grade não cabe nessa folha
- a janela de corte ficou vazia — o vídeo tem
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/fc7c39ad0a8cb641.
Report an issue: GitHub.
Appendix: source
Thrown at src/routes/study/anki/import/+page.svelte:429
{#if result}
<section class="card result-card">
<header class="card-head">
<h2>Importação concluída</h2>
<span class="kind-badge">{result.kind.toUpperCase()}</span>
</header>
<ul class="summary-list">
{#each summaryRows(result) as row (row.label)}
<li>
<span class="row-label">{row.label}</span>
<span class="row-value">{row.value}</span>
</li>
{/each}
</ul>
{#if result.kind === "csv" && result.data.errors.length > 0}
<details class="errors">
<summary>{result.data.errors.length} linhas com erro</summary>
<ul>
{#each result.data.errors.slice(0, 20) as err (err)}
<li>{err}</li>
{/each}
{#if result.data.errors.length > 20}
<li class="muted">… e mais {result.data.errors.length - 20}</li>
{/if}
</ul>
</details>
{/if}
<footer class="card-foot">
<a class="back-link" href="/study/anki">Ver no painel →</a>
</footer>
</section>
{/if}
</section>
<style>
.study-page {
display: flex;View on GitHub (pinned to 8600b91f42)