{"record":{"id":"35843a297fe0adfd","repo":"mifi/lossless-cut","slug":"invalid-start-or-end-value-must-contain-a-number","errorCode":null,"errorMessage":"Invalid start or end value. Must contain a number of seconds","messagePattern":"Invalid start or end value\\. Must contain a number of seconds","errorType":"exception","errorClass":"UserFacingError","httpStatus":null,"severity":"error","filePath":"src/renderer/src/edlFormats.ts","lineNumber":103,"sourceCode":"      ...(name != null && { name: name?.trim() }),\n      ...(tagsColumns.length > 0 && {\n        tags: Object.fromEntries(tagsColumns.flatMap((tagValue, tagIndex) => {\n          if (tagValue.trim() === '') return [];\n          return [[\n            tagsKeys?.[tagIndex] ?? `tag${tagIndex + 1}`,\n            tagValue.trim(),\n          ]];\n        })),\n      }),\n    }];\n  });\n\n  if (!mapped.every(({ start, end }) => (\n    !Number.isNaN(start)\n    && (end === undefined || !Number.isNaN(end))\n  ))) {\n    console.log(mapped);\n    throw new UserFacingError(i18n.t('Invalid start or end value. Must contain a number of seconds'));\n  }\n\n  return mapped;\n}\n\nexport async function parseCutlist(clStr: string) {\n  // first parse INI-File into \"iniValue\" object\n  const regex = {\n    section: /^\\s*\\[\\s*([^\\]]*)\\s*]\\s*$/,\n    param: /^\\s*([^=]+?)\\s*=\\s*(.*?)\\s*$/,\n    comment: /^\\s*;.*$/,\n  };\n  const iniValue: Record<string, string | undefined | Record<string, string | undefined>> = {};\n\n  const lines = clStr.split(/[\\n\\r]+/);\n  let section: string | undefined;\n  lines.forEach((line) => {\n    if (regex.comment.test(line)) {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/mifi/lossless-cut/blob/3b9a59c288bf6e11076b583c932cfa48ddab3b02/src/renderer/src/edlFormats.ts#L85-L121","documentation":"Thrown by parseCsv() after all rows are mapped, when the every() check finds at least one segment whose start (or end) is NaN. The parseTimeFn callback (e.g. parseCsvTime or a frame-based parser) returned NaN for a cell, meaning the cell could not be interpreted as a number of seconds or a recognized timecode. The error is raised because LosslessCut cannot place a segment whose boundary is not a finite number on the timeline.","triggerScenarios":"A CSV row whose Start or End column contains non-numeric text (e.g. 'foo', '', 'N/A') while using a numeric/seconds parser; a timecode string the chosen parseTimeFn does not recognize (e.g. '1:23:45.6' fed to a pure-seconds parser); a locale-specific decimal separator ('1,5') parsed by a parseFloat that yields NaN.","commonSituations":"Hand-edited CSVs where a user typed a label into the Start column; CSVs exported with a different time format (HH:MM:SS vs seconds) than the selected import parser expects; spreadsheets that formatted times as text or inserted stray quote characters; mixed delimiter (semicolon CSV opened as comma).","solutions":["Inspect console.log(mapped) output (the source logs it before throwing) to find which row has NaN start/end.","Correct or remove the offending cell so the Start/End columns contain a value the active parser understands (plain seconds like 12.5, or a supported timecode).","Match the import time parser to the CSV's actual format (seconds vs HH:MM:SS vs frame number).","Sanitize the CSV in a spreadsheet: force Start/End columns to numeric, remove thousands separators and convert commas to dots."],"exampleFix":"// before\nreturn parseCsv(text, parseCsvTime);\n\n// after\n// pre-validate each Start/End cell is a finite number of seconds\nconst rows = csvParse(text, {});\nconst bad = rows.find(([s]) => s != null && Number.isNaN(parseCsvTime(s)));\nif (bad) throw new Error(`Unparseable start time: '${bad[0]}'`);\nreturn parseCsv(text, parseCsvTime);","handlingStrategy":"validation","validationCode":"// Pre-validate that every Start/End cell parses to a finite number\nimport { csvParse } from 'csv-parse/sync';\nexport function validateCsvTimes(csvStr: string, parseTimeFn: (s: string) => number | undefined): string[] {\n  const rows = csvParse(csvStr, {});\n  const problems: string[] = [];\n  rows.forEach(([start, end], i) => {\n    if (start != null && Number.isNaN(parseTimeFn(start) ?? NaN)) problems.push(`Row ${i + 1} start '${start}' is not a number`);\n    if (end != null && Number.isNaN(parseTimeFn(end) ?? NaN)) problems.push(`Row ${i + 1} end '${end}' is not a number`);\n  });\n  return problems;\n}","typeGuard":"const isFiniteSeconds = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":"try {\n  return parseCsv(text, parser);\n} catch (err) {\n  if (err instanceof UserFacingError && /Invalid start or end/.test(err.message)) {\n    const problems = validateCsvTimes(text, parser);\n    showError('Unparseable time values', problems.join('\\n'));\n    return [];\n  }\n  throw err;\n}","preventionTips":["Match the import time parser to the CSV's actual format (seconds vs timecode vs frames).","In spreadsheets, force Start/End columns to numeric and use a dot decimal separator.","Pre-scan cells with validateCsvTimes to report the exact offending row to the user."],"tags":["csv","parsing","edl-import","validation","timecode","user-input"],"backgroundTag":null,"analyzedSha":"3b9a59c288bf6e11076b583c932cfa48ddab3b02","analyzedAt":"2026-08-12T20:54:25.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}