{"record":{"id":"a7ab50098679d140","repo":"jackwener/OpenCLI","slug":"empty-response-a7ab50","errorCode":"EMPTY_RESPONSE","errorMessage":"EMPTY_RESPONSE","messagePattern":"EMPTY_RESPONSE","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/generate.js","lineNumber":71,"sourceCode":"                body.imageUrl = kwargs.image;\n        }\n        else if (modelId === 'flux-kontext-pro') {\n            body = { prompt, output_format: 'jpg' };\n            if (kwargs.image)\n                body.imageUrl = kwargs.image;\n            if (ratio !== '1:1')\n                body.aspect_ratio = ratio;\n        }\n        else {\n            body = { prompt, aspect_ratio: ratio };\n            if (kwargs.image)\n                body.imageUrl = kwargs.image;\n        }\n        log.status(`Generating with ${modelId}...`);\n        const data = await yollomiPost(page, apiPath, body);\n        const images = data.images || (data.image ? [data.image] : []);\n        if (!images.length)\n            throw new CliError('EMPTY_RESPONSE', 'No images returned', 'Try a different prompt or model');\n        const noDownload = kwargs['no-download'];\n        const outputDir = kwargs.output;\n        const results = [];\n        for (let i = 0; i < images.length; i++) {\n            const url = images[i];\n            if (noDownload) {\n                results.push({ index: i + 1, status: 'generated', file: '-', size: '-', url });\n                continue;\n            }\n            try {\n                const urlPath = (() => { try {\n                    return new URL(url).pathname;\n                }\n                catch {\n                    return url;\n                } })();\n                const ext = urlPath.endsWith('.png') || urlPath.endsWith('.webp') ? urlPath.slice(urlPath.lastIndexOf('.')) : '.jpg';\n                const filename = `yollomi_${modelId}_${Date.now()}_${i + 1}${ext}`;","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/generate.js#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst images = data.images || (data.image ? [data.image] : []);\nif (!images.length) throw new CliError('EMPTY_RESPONSE', 'No images returned', 'Try a different prompt or model');\n// after\nif (data.error) throw new CliError('API_ERROR', data.error, 'Inspect generation response');\nconst images = data.images || (data.image ? [data.image] : (data.output ?? []));\nif (!images.length) throw new CliError('EMPTY_RESPONSE', 'No images returned', 'Try a different prompt or model');","handlingStrategy":"retry","validationCode":"if (!prompt || !prompt.trim()) throw new Error('prompt required');\nif (kwargs.image && !(await fetch(kwargs.image, { method: 'HEAD' })).ok) throw new Error('img2img image URL not reachable');","typeGuard":"function hasGeneratedImages(d) {\n  return d != null && (typeof d.image === 'string' || (Array.isArray(d.images) && d.images.length > 0));\n}","tryCatchPattern":"for (let attempt = 0; attempt < 2; attempt++) {\n  try {\n    const rows = await opencli.yollomi.generate({ prompt, model, ratio });\n    break;\n  } catch (e) {\n    if (e.code === 'EMPTY_RESPONSE' && attempt === 0) continue; // retry once\n    if (e.code === 'EMPTY_RESPONSE') console.error(`${e.message}: ${e.hint}`);\n    else throw e;\n  }\n}","preventionTips":["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"],"tags":["empty-response","api","cli","image-generation"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}