{"record":{"id":"b31d1b1be6550b9f","repo":"nexu-io/open-design","slug":"vela-video-only-supports-durations-of-5-or-10-seco","errorCode":null,"errorMessage":"Vela video only supports durations of 5 or 10 seconds; received ${input.length}","messagePattern":"Vela video only supports durations of 5 or 10 seconds; received (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/vela.ts","lineNumber":425,"sourceCode":"      } · ${requestedQuality ?? 'model default quality'} · ${bytes.length} bytes`,\n      suggestedExt: extensionForImageMime(mime),\n    };\n  } finally {\n    await rm(tempDir, { recursive: true, force: true });\n  }\n}\n\nexport async function renderVelaVideo(\n  input: VelaVideoRenderInput,\n  runCommand: VelaCommandRunner = runVelaCommand,\n): Promise<VelaRenderResult> {\n  assertInputImageCount(input.imageRefs);\n  const ratio = input.aspect ?? '16:9';\n  if (!VELA_VIDEO_RATIOS.has(ratio)) {\n    throw new Error(`Vela video only supports aspect ratios 16:9, 9:16, or 1:1; received ${ratio}`);\n  }\n  if (input.length != null && !VELA_VIDEO_DURATIONS.has(input.length)) {\n    throw new Error(`Vela video only supports durations of 5 or 10 seconds; received ${input.length}`);\n  }\n\n  const wireModel = wireModelForVela(input.model, input.wireModel);\n  const tempDir = await mkdtemp(path.join(os.tmpdir(), 'open-design-vela-video-'));\n  const outputPath = path.join(tempDir, 'result.mp4');\n  const startedAt = Date.now();\n  const pollIntervalMs = positiveIntegerFromEnv(\n    'OD_VELA_VIDEO_POLL_INTERVAL_MS',\n    DEFAULT_VELA_VIDEO_POLL_INTERVAL_MS,\n  );\n  const totalTimeoutMs = positiveIntegerFromEnv(\n    'OD_VELA_VIDEO_TIMEOUT_MS',\n    DEFAULT_VELA_VIDEO_TOTAL_TIMEOUT_MS,\n  );\n  const pollCommandTimeoutMs = positiveIntegerFromEnv(\n    'OD_VELA_VIDEO_POLL_COMMAND_TIMEOUT_MS',\n    DEFAULT_VELA_VIDEO_POLL_COMMAND_TIMEOUT_MS,\n  );","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/vela.ts#L407-L443","documentation":"Thrown when input.length is provided but is not in VELA_VIDEO_DURATIONS = new Set([5, 10]). The set contains numbers, not strings — a string '5' will fail the .has() check because Set uses strict equality. This check is skipped entirely when input.length is null/undefined (defaults to 5s downstream).","triggerScenarios":"Calling renderVelaVideo with input.length set to any value other than the number 5 or the number 10 — e.g. input.length = 15, input.length = '5' (string), input.length = 0, input.length = 3.","commonSituations":"Passing duration as a string from a JSON payload without coercing to number; UI offering durations the backend doesn't support; caller assuming the value is in seconds and passing arbitrary integers.","solutions":["Set input.length to the number 5 or the number 10","Omit input.length to default to 5 seconds at render time","Coerce string inputs with Number(input.length) and verify the result is 5 or 10 before calling"],"exampleFix":"// before — string '5' fails Set.has because Set uses ===\nrenderVelaVideo({ length: '5', imageRefs: refs, ... });\n\n// after — number 5 passes the check\nrenderVelaVideo({ length: 5, imageRefs: refs, ... });","handlingStrategy":"validation","validationCode":"const VELA_VIDEO_DURATIONS = new Set([5, 10]);\nfunction assertValidVelaDuration(length) {\n  if (length != null && !VELA_VIDEO_DURATIONS.has(length)) {\n    throw new Error(`Unsupported duration: ${length}. Use 5 or 10 (number).`);\n  }\n  return length;\n}","typeGuard":"function isVelaVideoDuration(value: unknown): value is 5 | 10 {\n  return (value === 5 || value === 10);\n}","tryCatchPattern":null,"preventionTips":["Always pass input.length as a number, never a string — Set.has uses strict equality","If receiving duration from JSON, coerce with Number() and validate before passing","Omit input.length entirely if the default 5s is acceptable"],"tags":["vela","video","validation","type-coercion"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}