jackwener/OpenCLI · error · CliError
EMPTY_RESPONSE
EMPTY_RESPONSE
Error message
EMPTY_RESPONSE
What it means
The yollomi generate command throws EMPTY_RESPONSE when the routed image-generation endpoint returns no images. It collects data.images or wraps data.image; an empty list means the model produced nothing, so it aborts before downloading any files.
Source
Thrown at clis/yollomi/generate.js:71
body.imageUrl = kwargs.image;
}
else if (modelId === 'flux-kontext-pro') {
body = { prompt, output_format: 'jpg' };
if (kwargs.image)
body.imageUrl = kwargs.image;
if (ratio !== '1:1')
body.aspect_ratio = ratio;
}
else {
body = { prompt, aspect_ratio: ratio };
if (kwargs.image)
body.imageUrl = kwargs.image;
}
log.status(`Generating with ${modelId}...`);
const data = await yollomiPost(page, apiPath, body);
const images = data.images || (data.image ? [data.image] : []);
if (!images.length)
throw new CliError('EMPTY_RESPONSE', 'No images returned', 'Try a different prompt or model');
const noDownload = kwargs['no-download'];
const outputDir = kwargs.output;
const results = [];
for (let i = 0; i < images.length; i++) {
const url = images[i];
if (noDownload) {
results.push({ index: i + 1, status: 'generated', file: '-', size: '-', url });
continue;
}
try {
const urlPath = (() => { try {
return new URL(url).pathname;
}
catch {
return url;
} })();
const ext = urlPath.endsWith('.png') || urlPath.endsWith('.webp') ? urlPath.slice(urlPath.lastIndexOf('.')) : '.jpg';
const filename = `yollomi_${modelId}_${Date.now()}_${i + 1}${ext}`;View on GitHub (pinned to 49907e53dc)
Solutions
- Try a different prompt or model (per the hint)
- If using img2img, verify --image points to a publicly reachable, supported image
- Log the raw response from yollomiPost to spot swallowed error fields
- Retry — transient endpoint outages often return empty bodies
- Check credits/login state on the yollomi site
Example fix
// before
const images = data.images || (data.image ? [data.image] : []);
if (!images.length) throw new CliError('EMPTY_RESPONSE', 'No images returned', 'Try a different prompt or model');
// after
if (data.error) throw new CliError('API_ERROR', data.error, 'Inspect generation response');
const images = data.images || (data.image ? [data.image] : (data.output ?? []));
if (!images.length) throw new CliError('EMPTY_RESPONSE', 'No images returned', 'Try a different prompt or model'); Defensive patterns
Strategy: retry
Validate before calling
if (!prompt || !prompt.trim()) throw new Error('prompt required');
if (kwargs.image && !(await fetch(kwargs.image, { method: 'HEAD' })).ok) throw new Error('img2img image URL not reachable'); Type guard
function hasGeneratedImages(d) {
return d != null && (typeof d.image === 'string' || (Array.isArray(d.images) && d.images.length > 0));
} Try / catch
for (let attempt = 0; attempt < 2; attempt++) {
try {
const rows = await opencli.yollomi.generate({ prompt, model, ratio });
break;
} catch (e) {
if (e.code === 'EMPTY_RESPONSE' && attempt === 0) continue; // retry once
if (e.code === 'EMPTY_RESPONSE') console.error(`${e.message}: ${e.hint}`);
else throw e;
}
} Prevention
- Retry once on EMPTY_RESPONSE — many are transient endpoint hiccups
- For img2img, verify --image is publicly reachable and a supported format
- Vary the prompt if a specific prompt consistently returns empty (moderation)
- Keep the CLI updated for response-schema changes
When it happens
Trigger: yollomiPost(page, apiPath, body) for a model in MODEL_ROUTES (e.g. z-image-turbo, flux-2-pro) resolves with no image fields — bad prompt rejected silently, kwargs.image pointing to an unfetchable image for img2img, or changed response schema.
Common situations: img2img calls where the --image URL is private/expired; moderation-blocked prompts; model endpoint outage returning 200 with empty payload; outdated CLI after site API change.
Related errors
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a7ab50098679d140.
Report an issue: GitHub.