{"record":{"id":"8c815678722292b5","repo":"nexu-io/open-design","slug":"vela-video-get-returned-unexpected-task-id-retur","errorCode":null,"errorMessage":"Vela video get returned unexpected task_id ${returnedTaskId ?? 'missing'} (expected ${taskId})","messagePattern":"Vela video get returned unexpected task_id (.+?) \\(expected (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/vela.ts","lineNumber":489,"sourceCode":"    if (!taskId) throw new Error('Vela video gen response is missing task_id');\n    lastStatus = nonEmptyString(submitted.status) ?? 'queued';\n    input.onProgress?.(`Vela video task ${taskId} accepted; polling status ${lastStatus}`);\n\n    while (Date.now() - startedAt < totalTimeoutMs) {\n      await wait(Math.min(pollIntervalMs, Math.max(1, totalTimeoutMs - (Date.now() - startedAt))));\n      if (Date.now() - startedAt >= totalTimeoutMs) break;\n\n      const pollStdout = await runCommand(\n        ['video', 'get', taskId, '--output', outputPath, '--json'],\n        {\n          ...velaWorkspaceCommandOptions(input.workspaceId),\n          timeoutMs: pollCommandTimeoutMs,\n        },\n      );\n      const task = parseJsonObject(pollStdout, 'video get');\n      const returnedTaskId = nonEmptyString(task.task_id);\n      if (returnedTaskId !== taskId) {\n        throw new Error(\n          `Vela video get returned unexpected task_id ${returnedTaskId ?? 'missing'} (expected ${taskId})`,\n        );\n      }\n      lastStatus = nonEmptyString(task.status) ?? 'missing';\n      const elapsedSeconds = Math.round((Date.now() - startedAt) / 1000);\n      input.onProgress?.(`Vela video status ${lastStatus}; elapsed ${elapsedSeconds}s`);\n\n      if (lastStatus === 'succeeded') {\n        const bytes = await readNonEmptyOutput(outputPath, 'video get');\n        return {\n          bytes,\n          providerNote: `vela/${wireModel} · ${ratio} · ${input.length ?? 5}s · ${DEFAULT_VELA_VIDEO_RESOLUTION} default · ${bytes.length} bytes`,\n          suggestedExt: '.mp4',\n        };\n      }\n      if (lastStatus === 'failed' || lastStatus === 'cancelled' || lastStatus === 'canceled') {\n        throw new Error(`Vela video task ended with status ${lastStatus}: ${videoTaskError(task)}`);\n      }","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/vela.ts#L471-L507","documentation":"During the polling loop, 'vela video get <taskId>' returns JSON whose task_id does not match the taskId that was submitted and is being polled. This is a consistency guard: nonEmptyString(task.task_id) must equal the original taskId.","triggerScenarios":"The Vela CLI's video get command returns data for a different task; the task_id field in the poll response is missing (nonEmptyString returns null, which !== taskId); a CLI bug or proxy rewriting response payloads.","commonSituations":"Vela CLI version mismatch causing task_id format changes (e.g. prefix added/removed); concurrent video tasks causing response confusion in the CLI; corrupted CLI state file.","solutions":["Update the Vela CLI to a version compatible with the daemon","Check for concurrent video generation requests that might interfere with task isolation","Inspect the poll response JSON to see what task_id value was returned","Clear Vela CLI state/cache and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const result = await renderVelaVideo(input);\n} catch (err) {\n  if (err.message.includes('unexpected task_id')) {\n    // Task isolation violation — abort and clean up\n    logger.error('Vela video task_id mismatch during polling', err);\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Avoid running concurrent video generation tasks that might cause CLI state confusion","Keep the Vela CLI version updated to match the daemon contract","Clear Vela CLI cache/state if task_id mismatches become recurrent"],"tags":["vela","video","polling","consistency-check"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}