nexu-io/open-design · error · Error

Vela image ${command} returned unexpected kind ${kind ?? 'mi

Error message

Vela image ${command} returned unexpected kind ${kind ?? 'missing'}

What it means

Thrown after the ready-status check when asset.kind is not the string 'image'. The daemon called an image gen/edit command and expects kind === 'image'; a different kind (e.g. 'video', 'audio') indicates a routing or schema problem. The actual kind (or 'missing') is shown.

Source

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

      '--output',
      outputPath,
      '--json',
    ];
    const stdout = await runCommand(args, {
      ...velaWorkspaceCommandOptions(input.workspaceId),
      timeoutMs: VELA_IMAGE_TIMEOUT_MS,
    });
    const asset = parseJsonObject(stdout, `image ${command}`);
    const assetId = nonEmptyString(asset.asset_id);
    const status = nonEmptyString(asset.status);
    const kind = nonEmptyString(asset.kind);
    const mime = nonEmptyString(asset.mime_type);
    if (!assetId) throw new Error(`Vela image ${command} response is missing asset_id`);
    if (status !== 'ready') {
      throw new Error(`Vela image ${command} returned non-ready asset status ${status ?? 'missing'}`);
    }
    if (kind !== 'image') {
      throw new Error(`Vela image ${command} returned unexpected kind ${kind ?? 'missing'}`);
    }
    if (!mime?.startsWith('image/')) {
      throw new Error(`Vela image ${command} returned invalid mime_type ${mime ?? 'missing'}`);
    }
    const bytes = await readNonEmptyOutput(outputPath, `image ${command}`);
    return {
      bytes,
      // The tier is part of what the user was charged for, so name it when it
      // was chosen and say so plainly when the server's default decided.
      providerNote: `vela/${wireModel} · ${
        profile ? `${profile.aspectRatio} ${profile.resolution}` : 'model default profile'
      } · ${requestedQuality ?? 'model default quality'} · ${bytes.length} bytes`,
      suggestedExt: extensionForImageMime(mime),
    };
  } finally {
    await rm(tempDir, { recursive: true, force: true });
  }
}

View on GitHub (pinned to 5be4028344)

Solutions

  1. Run the Vela image command directly and inspect the kind field in the response
  2. Confirm the model id routes to image generation, not video/audio
  3. Check the Vela CLI version for a kind-field schema change
  4. Update the parser if Vela renamed or restructured the kind field
Defensive patterns

Strategy: type-guard

Validate before calling

function assetIsImageKind(asset: Record<string, unknown>): boolean {
  return asset.kind === 'image';
}

Type guard

function isImageAsset(asset: unknown): asset is { kind: 'image' } {
  return typeof asset === 'object' && asset !== null
    && (asset as { kind?: unknown }).kind === 'image';
}

Try / catch

try {
  if (!isImageAsset(asset)) throw new Error(`unexpected kind: ${asset.kind ?? 'missing'}`);
} catch (err) {
  // verify the model id routes to image generation; rethrow otherwise
}

Prevention

When it happens

Trigger: Vela image gen/edit JSON has a kind field that is not 'image' — for example the endpoint returned a video/audio asset, or the field is missing/renamed.

Common situations: Wrong CLI subcommand was routed but parsed as image; Vela renamed the kind field; a model rollout returned a different asset type; cross-kind response from a misconfigured model id.

Related errors


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