{"record":{"id":"3a10f6e5d3435b22","repo":"nexu-io/open-design","slug":"vela-image-command-returned-unexpected-kind-k","errorCode":null,"errorMessage":"Vela image ${command} returned unexpected kind ${kind ?? 'missing'}","messagePattern":"Vela image (.+?) returned unexpected kind (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/vela.ts","lineNumber":395,"sourceCode":"      '--output',\n      outputPath,\n      '--json',\n    ];\n    const stdout = await runCommand(args, {\n      ...velaWorkspaceCommandOptions(input.workspaceId),\n      timeoutMs: VELA_IMAGE_TIMEOUT_MS,\n    });\n    const asset = parseJsonObject(stdout, `image ${command}`);\n    const assetId = nonEmptyString(asset.asset_id);\n    const status = nonEmptyString(asset.status);\n    const kind = nonEmptyString(asset.kind);\n    const mime = nonEmptyString(asset.mime_type);\n    if (!assetId) throw new Error(`Vela image ${command} response is missing asset_id`);\n    if (status !== 'ready') {\n      throw new Error(`Vela image ${command} returned non-ready asset status ${status ?? 'missing'}`);\n    }\n    if (kind !== 'image') {\n      throw new Error(`Vela image ${command} returned unexpected kind ${kind ?? 'missing'}`);\n    }\n    if (!mime?.startsWith('image/')) {\n      throw new Error(`Vela image ${command} returned invalid mime_type ${mime ?? 'missing'}`);\n    }\n    const bytes = await readNonEmptyOutput(outputPath, `image ${command}`);\n    return {\n      bytes,\n      // The tier is part of what the user was charged for, so name it when it\n      // was chosen and say so plainly when the server's default decided.\n      providerNote: `vela/${wireModel} · ${\n        profile ? `${profile.aspectRatio} ${profile.resolution}` : 'model default profile'\n      } · ${requestedQuality ?? 'model default quality'} · ${bytes.length} bytes`,\n      suggestedExt: extensionForImageMime(mime),\n    };\n  } finally {\n    await rm(tempDir, { recursive: true, force: true });\n  }\n}","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/vela.ts#L377-L413","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the Vela image command directly and inspect the kind field in the response","Confirm the model id routes to image generation, not video/audio","Check the Vela CLI version for a kind-field schema change","Update the parser if Vela renamed or restructured the kind field"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"function assetIsImageKind(asset: Record<string, unknown>): boolean {\n  return asset.kind === 'image';\n}","typeGuard":"function isImageAsset(asset: unknown): asset is { kind: 'image' } {\n  return typeof asset === 'object' && asset !== null\n    && (asset as { kind?: unknown }).kind === 'image';\n}","tryCatchPattern":"try {\n  if (!isImageAsset(asset)) throw new Error(`unexpected kind: ${asset.kind ?? 'missing'}`);\n} catch (err) {\n  // verify the model id routes to image generation; rethrow otherwise\n}","preventionTips":["Confirm the model id routes to image generation before calling renderVelaImage","Pin the Vela CLI version so the kind field schema is stable","Capture the full response on a kind mismatch to diagnose routing or schema changes"],"tags":["vela","response","schema","upstream"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}