{"record":{"id":"e926e0f00ba670f9","repo":"nexu-io/open-design","slug":"vela-image-command-returned-invalid-mime-type","errorCode":null,"errorMessage":"Vela image ${command} returned invalid mime_type ${mime ?? 'missing'}","messagePattern":"Vela image (.+?) returned invalid mime_type (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/vela.ts","lineNumber":398,"sourceCode":"    ];\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}\n\nexport async function renderVelaVideo(\n  input: VelaVideoRenderInput,","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/vela.ts#L380-L416","documentation":"Thrown after the kind check when asset.mime_type is absent or does not start with 'image/'. This validates the asset is an image before the daemon tries to map the mime to a file extension (error 486 then handles the narrower format check). The actual mime_type (or 'missing') is shown.","triggerScenarios":"Vela image gen/edit JSON has a mime_type field that is missing, empty, or a non-image type (e.g. 'video/mp4', 'application/octet-stream').","commonSituations":"Vela returned a non-image asset under an image command; mime_type field renamed in a newer CLI version; model rollout changed output type; upstream bug returning a placeholder mime.","solutions":["Run the Vela image command directly and inspect the mime_type field","Confirm the model produces image output for that command","Check the Vela CLI version for a mime_type field rename","Update the response parser if the field name changed"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"function assetHasImageMime(asset: Record<string, unknown>): boolean {\n  return typeof asset.mime_type === 'string' && asset.mime_type.startsWith('image/');\n}","typeGuard":"function hasImageMime(asset: unknown): asset is { mime_type: string } {\n  return typeof asset === 'object' && asset !== null\n    && typeof (asset as { mime_type?: unknown }).mime_type === 'string'\n    && ((asset as { mime_type: string }).mime_type.startsWith('image/'));\n}","tryCatchPattern":"try {\n  if (!hasImageMime(asset)) throw new Error(`invalid mime_type: ${asset.mime_type ?? 'missing'}`);\n} catch (err) {\n  // verify the model produces image output; capture full response for diagnosis\n}","preventionTips":["Confirm the model produces image output for the given command","Pin the Vela CLI version so the mime_type field name is stable","Capture the full asset envelope on a mime mismatch to spot schema or routing changes"],"tags":["vela","response","mime","upstream"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}