nexu-io/open-design · error · Error

Vela video get returned unexpected task_id ${returnedTaskId

Error message

Vela video get returned unexpected task_id ${returnedTaskId ?? 'missing'} (expected ${taskId})

What it means

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.

Source

Thrown at apps/daemon/src/media/vela.ts:489

    if (!taskId) throw new Error('Vela video gen response is missing task_id');
    lastStatus = nonEmptyString(submitted.status) ?? 'queued';
    input.onProgress?.(`Vela video task ${taskId} accepted; polling status ${lastStatus}`);

    while (Date.now() - startedAt < totalTimeoutMs) {
      await wait(Math.min(pollIntervalMs, Math.max(1, totalTimeoutMs - (Date.now() - startedAt))));
      if (Date.now() - startedAt >= totalTimeoutMs) break;

      const pollStdout = await runCommand(
        ['video', 'get', taskId, '--output', outputPath, '--json'],
        {
          ...velaWorkspaceCommandOptions(input.workspaceId),
          timeoutMs: pollCommandTimeoutMs,
        },
      );
      const task = parseJsonObject(pollStdout, 'video get');
      const returnedTaskId = nonEmptyString(task.task_id);
      if (returnedTaskId !== taskId) {
        throw new Error(
          `Vela video get returned unexpected task_id ${returnedTaskId ?? 'missing'} (expected ${taskId})`,
        );
      }
      lastStatus = nonEmptyString(task.status) ?? 'missing';
      const elapsedSeconds = Math.round((Date.now() - startedAt) / 1000);
      input.onProgress?.(`Vela video status ${lastStatus}; elapsed ${elapsedSeconds}s`);

      if (lastStatus === 'succeeded') {
        const bytes = await readNonEmptyOutput(outputPath, 'video get');
        return {
          bytes,
          providerNote: `vela/${wireModel} · ${ratio} · ${input.length ?? 5}s · ${DEFAULT_VELA_VIDEO_RESOLUTION} default · ${bytes.length} bytes`,
          suggestedExt: '.mp4',
        };
      }
      if (lastStatus === 'failed' || lastStatus === 'cancelled' || lastStatus === 'canceled') {
        throw new Error(`Vela video task ended with status ${lastStatus}: ${videoTaskError(task)}`);
      }

View on GitHub (pinned to 5be4028344)

Solutions

  1. Update the Vela CLI to a version compatible with the daemon
  2. Check for concurrent video generation requests that might interfere with task isolation
  3. Inspect the poll response JSON to see what task_id value was returned
  4. Clear Vela CLI state/cache and retry
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const result = await renderVelaVideo(input);
} catch (err) {
  if (err.message.includes('unexpected task_id')) {
    // Task isolation violation — abort and clean up
    logger.error('Vela video task_id mismatch during polling', err);
    throw err;
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/8c815678722292b5. Report an issue: GitHub.