jackwener/OpenCLI · error · CliError

EMPTY_RESPONSE

EMPTY_RESPONSE

Error message

EMPTY_RESPONSE

What it means

The yollomi edit command throws EMPTY_RESPONSE when the qwen-image-edit (or qwen-image-edit-plus) endpoint returns no images. It normalizes data.images / data.image into an array; an empty array means no edit result was produced, so it aborts before reporting credits or downloading.

Source

Thrown at clis/yollomi/edit.js:41

    ],
    columns: ['status', 'file', 'size', 'credits', 'url'],
    func: async (page, kwargs) => {
        const imageInput = kwargs.image;
        const prompt = kwargs.prompt;
        const modelId = kwargs.model;
        let body;
        if (modelId === 'qwen-image-edit-plus') {
            body = { prompt, images: [imageInput] };
        }
        else {
            body = { image: imageInput, prompt, go_fast: true, output_format: 'png' };
        }
        const apiPath = modelId === 'qwen-image-edit-plus' ? '/api/ai/qwen-image-edit-plus' : '/api/ai/qwen-image-edit';
        log.status(`Editing 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 result', 'Try a different prompt');
        const credits = data.remainingCredits;
        const url = images[0];
        if (kwargs['no-download'])
            return [{ status: 'edited', file: '-', size: '-', credits: credits ?? '-', url }];
        try {
            const filename = `yollomi_edit_${Date.now()}.png`;
            const { path: fp, size } = await downloadOutput(url, kwargs.output, filename);
            if (credits !== undefined)
                log.status(`Credits remaining: ${credits}`);
            return [{ status: 'saved', file: path.relative('.', fp), size: fmtBytes(size), credits: credits ?? '-', url }];
        }
        catch {
            return [{ status: 'download-failed', file: '-', size: '-', credits: credits ?? '-', url }];
        }
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a different prompt (as the hint says) — moderation rejections often return empty
  2. Log the raw response body to see if there is an error field the CLI is ignoring
  3. Verify the source image loads and is a supported format
  4. Check remaining credits / login validity on the site
  5. Update the images extraction if the API response schema changed

Example fix

// before
const images = data.images || (data.image ? [data.image] : []);
if (!images.length) throw new CliError('EMPTY_RESPONSE', 'No result', 'Try a different prompt');
// after
if (data.error) throw new CliError('API_ERROR', data.error, 'See site docs');
const images = data.images || (data.image ? [data.image] : (data.result?.images ?? []));
if (!images.length) throw new CliError('EMPTY_RESPONSE', 'No result', 'Try a different prompt');
Defensive patterns

Strategy: try-catch

Validate before calling

if (!prompt || prompt.trim().length < 3) throw new Error('prompt required');
const ok = await fetch(sourceImageUrl, { method: 'HEAD' });
if (!ok.ok) throw new Error(`source image not reachable: ${ok.status}`);

Type guard

function hasImages(d) {
  return d != null && (typeof d.image === 'string' || (Array.isArray(d.images) && d.images.length > 0));
}

Try / catch

try {
  const rows = await opencli.yollomi.edit({ prompt, image: src, model: 'qwen-image-edit' });
} catch (e) {
  if (e.code === 'EMPTY_RESPONSE') {
    // moderation/silent rejection: rephrase prompt and retry once
    console.error(`${e.message}: ${e.hint}`);
  } else throw e;
}

Prevention

When it happens

Trigger: yollomiPost(page, '/api/ai/qwen-image-edit[+]', body) resolves with a body where data.images is empty/undefined and data.image is undefined — e.g. prompt rejected by moderation, image failed to load server-side, or response schema changed.

Common situations: Content-moderation rejection of the prompt or source image; using a model id whose endpoint silently fails; session/credits expired mid-request; site API updated field names.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/4b2e109c2f619e18. Report an issue: GitHub.