{"record":{"id":"9867cfba51df22fc","repo":"mifi/lossless-cut","slug":"no-rows-found","errorCode":null,"errorMessage":"No rows found","messagePattern":"No rows found","errorType":"exception","errorClass":"UserFacingError","httpStatus":null,"severity":"error","filePath":"src/renderer/src/edlFormats.ts","lineNumber":61,"sourceCode":"  return parsed?.time;\n}\n\nexport const getFrameValParser = (fps: number) => (str: string) => {\n  if (str === '') return undefined;\n  const frameCount = parseFloat(str);\n  return getTimeFromFrameNum(fps, frameCount);\n};\n\nconst csvHeader = [\n  'Start',\n  'End',\n  'Name',\n] as const;\n\nexport function parseCsv(csvStr: string, parseTimeFn: (a: string) => number | undefined) {\n  const rows: string[][] = csvParse(csvStr, {});\n\n  if (rows.length === 0) throw new UserFacingError(i18n.t('No rows found'));\n  invariant(rows.every((row) => row.length > 0), 'One row had no columns.');\n\n  // from header\n  let tagsKeys: string[] | undefined;\n\n  const mapped = rows.flatMap(([start, end, name, ...tagsColumns], rowIndex) => {\n    invariant(start != null, `Row ${rowIndex + 1} has no start time`);\n\n    if (rowIndex === 0\n      && start === csvHeader[0]\n      && (end == null || end === csvHeader[1])\n      && (name == null || name === csvHeader[2])\n    ) {\n      if (end === csvHeader[1] && name === csvHeader[2]) {\n        tagsKeys = tagsColumns.map((tag) => tag.trim());\n      }\n      // skip header row\n      return [];","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/mifi/lossless-cut/blob/3b9a59c288bf6e11076b583c932cfa48ddab3b02/src/renderer/src/edlFormats.ts#L43-L79","documentation":"Thrown by parseCsv() in edlFormats.ts when csvParse() returns a rows array of length 0. This is a UserFacingError raised before any row mapping happens, signalling that the supplied CSV string contained no parseable rows at all. It is a hard precondition gate: the function refuses to produce an empty segment list because every downstream consumer (EDL import, segment loading) assumes at least one row.","triggerScenarios":"Calling parseCsv(csvStr, parseTimeFn) with an empty string, a string of only whitespace/newlines, or a CSV whose sole content is a single comma-less blank line that csvParse collapses to zero rows. Also triggered when a user imports a file that has a .csv extension but is actually empty or binary garbage that the parser drops entirely.","commonSituations":"Exporting an EDL/CSV from another NLE that wrote a 0-byte file; selecting the wrong file in the import dialog; a file truncated by a failed download or sync; copy-pasting only the header-less空白 or a stray BOM/whitespace into the CSV import field.","solutions":["Verify the CSV file actually contains data: open it in a text editor and confirm there is at least one non-empty line before importing.","Ensure the file is genuinely CSV (comma-separated) and not a different format saved with a .csv extension; re-export from the source tool.","If generating CSV programmatically, guard the parseCsv call by checking the trimmed string is non-empty first.","Catch UserFacingError at the import call site and show the user a friendly 'this CSV appears to be empty' message instead of crashing."],"exampleFix":"// before\nconst segments = parseCsv(text, parseCsvTime);\n\n// after\nif (text.trim() === '') throw new Error('CSV file is empty');\nconst segments = parseCsv(text, parseCsvTime);","handlingStrategy":"validation","validationCode":"// Run before parseCsv\nexport function assertCsvHasRows(csvStr: string): void {\n  const trimmed = csvStr.trim();\n  if (trimmed === '') {\n    throw new Error('CSV content is empty; nothing to import.');\n  }\n}\n// usage\nassertCsvHasRows(text);\nconst segments = parseCsv(text, parseCsvTime);","typeGuard":null,"tryCatchPattern":"try {\n  const segments = parseCsv(text, parseCsvTime);\n} catch (err) {\n  if (err instanceof UserFacingError && /No rows found/.test(err.message)) {\n    showError('The selected CSV file is empty.');\n    return;\n  }\n  throw err;\n}","preventionTips":["Validate the file size is > 0 before reading it as CSV.","Trim and check the string is non-empty before invoking parseCsv.","Surface import errors through a user-facing toast rather than letting them propagate to the app error boundary."],"tags":["csv","parsing","edl-import","validation","user-input"],"backgroundTag":null,"analyzedSha":"3b9a59c288bf6e11076b583c932cfa48ddab3b02","analyzedAt":"2026-08-12T20:54:25.651Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}