{"record":{"id":"c5410eeeab0f8a5e","repo":"jackwener/OpenCLI","slug":"empty-response-c5410e","errorCode":"EMPTY_RESPONSE","errorMessage":"EMPTY_RESPONSE","messagePattern":"EMPTY_RESPONSE","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/upscale.js","lineNumber":33,"sourceCode":"    strategy: Strategy.COOKIE,\n    args: [\n        { name: 'image', positional: true, required: true, help: 'Image URL to upscale' },\n        { name: 'scale', default: '2', choices: ['2', '4'], help: 'Upscale factor (2 or 4)' },\n        { name: 'output', default: './yollomi-output', help: 'Output directory' },\n        { name: 'no-download', type: 'boolean', default: false, help: 'Only show URL' },\n    ],\n    columns: ['status', 'file', 'size', 'scale', 'url'],\n    func: async (page, kwargs) => {\n        const scale = parseInt(kwargs.scale, 10);\n        log.status(`Upscaling ${scale}x...`);\n        const data = await yollomiPost(page, '/api/ai/image-upscaler', {\n            imageUrl: kwargs.image,\n            scale,\n            face_enhance: false,\n        });\n        const url = data.image || (data.images?.[0]);\n        if (!url)\n            throw new CliError('EMPTY_RESPONSE', 'No result', 'Check the input image');\n        if (kwargs['no-download'])\n            return [{ status: 'upscaled', file: '-', size: '-', scale: `${scale}x`, url }];\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_upscale_${scale}x_${Date.now()}${ext}`;\n            const { path: fp, size } = await downloadOutput(url, kwargs.output, filename);\n            if (data.remainingCredits !== undefined)\n                log.status(`Credits remaining: ${data.remainingCredits}`);\n            return [{ status: 'saved', file: path.relative('.', fp), size: fmtBytes(size), scale: `${scale}x`, url }];\n        }\n        catch {\n            return [{ status: 'download-failed', file: '-', size: '-', scale: `${scale}x`, url }];","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/upscale.js#L15-L51","documentation":"EMPTY_RESPONSE is thrown by the upscale command when the API response contains neither data.image nor a non-empty data.images[0] — i.e. the request succeeded (no API_ERROR) but no result URL came back. The library treats a missing result URL as an unusable response rather than silently returning nothing.","triggerScenarios":"Calling the upscale command and yollomiPost returns a parsed body lacking image/images fields — e.g. the API returned an unexpected shape, a partial success, or an empty object.","commonSituations":"Upgrading model/server versions that changed the response schema, passing a corrupt or unreachable input image that produced no output, or API-side processing silently producing zero results.","solutions":["Verify the input image URL is valid and publicly reachable (this is what the fix hint points at)","Log or print the raw response (e.g. use --no-download or inspect network tab in the bridged Chrome) to see the actual body shape","Retry — transient backend issues can yield empty payloads","Update the CLI if the yollomi API response schema changed; check for a newer version"],"exampleFix":"// before\nyollomi upscale --image https://example.com/broken-link.png\n// EMPTY_RESPONSE: No result\n// after\nyollomi upscale --image https://example.com/real-photo.jpg","handlingStrategy":"type-guard","validationCode":"// Pre-check that an image URL is reachable before using it as input\nconst head = await fetch(imageUrl, { method: 'HEAD' });\nif (!head.ok) throw new Error(`Input image unreachable: HTTP ${head.status}`);","typeGuard":"function hasResultUrl(data) {\n  return typeof data?.image === 'string' && data.image.length > 0\n    || typeof data?.images?.[0] === 'string' && data.images[0].length > 0;\n}","tryCatchPattern":"try {\n  const out = await upscale(page, { image });\n} catch (e) {\n  if (e.code === 'EMPTY_RESPONSE') console.error('No result URL — verify input image and retry');\n  else throw e;\n}","preventionTips":["Validate input image URLs are publicly reachable before upscales","Pin/verify model names after API updates","Retry once before failing a batch job"],"tags":["cli","upscale","empty-response","api-schema"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}