{"record":{"id":"3da3955dcb9b7186","repo":"nexu-io/open-design","slug":"vela-image-command-response-is-missing-asset-id","errorCode":null,"errorMessage":"Vela image ${command} response is missing asset_id","messagePattern":"Vela image (.+?) response is missing asset_id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/vela.ts","lineNumber":390,"sourceCode":"      ...stagedImageRefs.flatMap((image) => ['--image', image.abs]),\n      ...(profile\n        ? ['--aspect-ratio', profile.aspectRatio, '--resolution', profile.resolution]\n        : []),\n      ...quality,\n      '--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),","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/vela.ts#L372-L408","documentation":"Thrown after parsing the Vela image gen/edit JSON response when asset.asset_id is empty or missing. The asset_id is the primary identifier for the generated asset; without it the daemon cannot reference, fetch, or attribute the result. The command name (gen or edit) is interpolated.","triggerScenarios":"Vela's image gen/edit returned a JSON object (parsed successfully) but the asset_id field is absent, null, or whitespace-only (nonEmptyString returns null).","commonSituations":"Vela CLI version changed the response schema and renamed asset_id; partial/failed generation returned a status envelope without the id; upstream bug.","solutions":["Run the same Vela image command with --json directly and inspect the asset object shape","Upgrade or pin the Vela CLI version to one whose schema matches","Check Vela stderr/logs for an upstream generation failure that produced a malformed response","Update the response parser if Vela renamed the field"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function hasAssetId(asset: Record<string, unknown>): boolean {\n  return typeof asset.asset_id === 'string' && asset.asset_id.trim().length > 0;\n}\n\nconst asset = parseJsonObject(stdout, label);\nif (!hasAssetId(asset)) {\n  throw new Error(`Vela ${label} response missing asset_id — check CLI version/schema`);\n}","typeGuard":"function hasVelaAssetId(asset: unknown): asset is { asset_id: string } {\n  return typeof asset === 'object' && asset !== null\n    && typeof (asset as { asset_id?: unknown }).asset_id === 'string'\n    && (asset as { asset_id: string }).asset_id.trim().length > 0;\n}","tryCatchPattern":"try {\n  const asset = parseJsonObject(stdout, label);\n  if (!hasVelaAssetId(asset)) throw new Error(`Vela ${label} response is missing asset_id`);\n} catch (err) {\n  // log full stdout for schema diagnosis, then rethrow or map to a retry\n}","preventionTips":["Pin the Vela CLI version and test the image response schema after upgrades","Capture the raw stdout on parse failures for post-mortem","Add a contract test that asserts the expected asset fields are present"],"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"}