{"record":{"id":"4b2e109c2f619e18","repo":"jackwener/OpenCLI","slug":"empty-response-4b2e10","errorCode":"EMPTY_RESPONSE","errorMessage":"EMPTY_RESPONSE","messagePattern":"EMPTY_RESPONSE","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/edit.js","lineNumber":41,"sourceCode":"    ],\n    columns: ['status', 'file', 'size', 'credits', 'url'],\n    func: async (page, kwargs) => {\n        const imageInput = kwargs.image;\n        const prompt = kwargs.prompt;\n        const modelId = kwargs.model;\n        let body;\n        if (modelId === 'qwen-image-edit-plus') {\n            body = { prompt, images: [imageInput] };\n        }\n        else {\n            body = { image: imageInput, prompt, go_fast: true, output_format: 'png' };\n        }\n        const apiPath = modelId === 'qwen-image-edit-plus' ? '/api/ai/qwen-image-edit-plus' : '/api/ai/qwen-image-edit';\n        log.status(`Editing 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 result', 'Try a different prompt');\n        const credits = data.remainingCredits;\n        const url = images[0];\n        if (kwargs['no-download'])\n            return [{ status: 'edited', file: '-', size: '-', credits: credits ?? '-', url }];\n        try {\n            const filename = `yollomi_edit_${Date.now()}.png`;\n            const { path: fp, size } = await downloadOutput(url, kwargs.output, filename);\n            if (credits !== undefined)\n                log.status(`Credits remaining: ${credits}`);\n            return [{ status: 'saved', file: path.relative('.', fp), size: fmtBytes(size), credits: credits ?? '-', url }];\n        }\n        catch {\n            return [{ status: 'download-failed', file: '-', size: '-', credits: credits ?? '-', url }];\n        }\n    },\n});\n","sourceCodeStart":23,"sourceCodeEnd":58,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/edit.js#L23-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry with a different prompt (as the hint says) — moderation rejections often return empty","Log the raw response body to see if there is an error field the CLI is ignoring","Verify the source image loads and is a supported format","Check remaining credits / login validity on the site","Update the images extraction if the API response schema changed"],"exampleFix":"// before\nconst images = data.images || (data.image ? [data.image] : []);\nif (!images.length) throw new CliError('EMPTY_RESPONSE', 'No result', 'Try a different prompt');\n// after\nif (data.error) throw new CliError('API_ERROR', data.error, 'See site docs');\nconst images = data.images || (data.image ? [data.image] : (data.result?.images ?? []));\nif (!images.length) throw new CliError('EMPTY_RESPONSE', 'No result', 'Try a different prompt');","handlingStrategy":"try-catch","validationCode":"if (!prompt || prompt.trim().length < 3) throw new Error('prompt required');\nconst ok = await fetch(sourceImageUrl, { method: 'HEAD' });\nif (!ok.ok) throw new Error(`source image not reachable: ${ok.status}`);","typeGuard":"function hasImages(d) {\n  return d != null && (typeof d.image === 'string' || (Array.isArray(d.images) && d.images.length > 0));\n}","tryCatchPattern":"try {\n  const rows = await opencli.yollomi.edit({ prompt, image: src, model: 'qwen-image-edit' });\n} catch (e) {\n  if (e.code === 'EMPTY_RESPONSE') {\n    // moderation/silent rejection: rephrase prompt and retry once\n    console.error(`${e.message}: ${e.hint}`);\n  } else throw e;\n}","preventionTips":["Keep prompts free of likely moderation triggers","Verify the source image URL is public and supported format","Catch EMPTY_RESPONSE explicitly and implement one rephrased retry","Check site credits/login before batch runs"],"tags":["empty-response","api","cli","image-edit"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}