{"record":{"id":"0bd4a0a524a70565","repo":"jackwener/OpenCLI","slug":"empty-response-0bd4a0","errorCode":"EMPTY_RESPONSE","errorMessage":"EMPTY_RESPONSE","messagePattern":"EMPTY_RESPONSE","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/restore.js","lineNumber":27,"sourceCode":"cli({\n    site: 'yollomi',\n    name: 'restore',\n    access: 'write',\n    description: 'Restore old or damaged photos with AI (4 credits)',\n    domain: YOLLOMI_DOMAIN,\n    strategy: Strategy.COOKIE,\n    args: [\n        { name: 'image', positional: true, required: true, help: 'Image URL to restore' },\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', 'url'],\n    func: async (page, kwargs) => {\n        log.status('Restoring photo...');\n        const data = await yollomiPost(page, '/api/ai/photo-restoration', { imageUrl: kwargs.image });\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: 'restored', file: '-', size: '-', url }];\n        try {\n            const filename = `yollomi_restored_${Date.now()}.jpg`;\n            const { path: fp, size } = await downloadOutput(url, kwargs.output, filename);\n            return [{ status: 'saved', file: path.relative('.', fp), size: fmtBytes(size), url }];\n        }\n        catch {\n            return [{ status: 'download-failed', file: '-', size: '-', url }];\n        }\n    },\n});\n","sourceCodeStart":9,"sourceCodeEnd":40,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/restore.js#L9-L40","documentation":"The yollomi restore command throws EMPTY_RESPONSE when /api/ai/photo-restoration returns no restored image. It reads data.image or data.images[0]; absence of both aborts the command before downloading.","triggerScenarios":"POSTing { imageUrl: kwargs.image } where the photo cannot be fetched/processed server-side (dead URL, unsupported format, image too large/degraded), or the response no longer contains image/images fields.","commonSituations":"Old scanned photos too degraded for the model; expired or private image URLs; passing a local path instead of a URL; site API schema change after an update.","solutions":["Check the input image is a valid, publicly reachable URL (per the hint)","Upload local files first with `yollomi upload` and use the returned URL","Retry — transient processing failures can return empty bodies","Log the raw response to look for ignored error fields","Adjust field extraction if the API response shape changed"],"exampleFix":"// before\nconst url = data.image || (data.images?.[0]);\nif (!url) throw new CliError('EMPTY_RESPONSE', 'No result', 'Check the input image');\n// after\nif (data.error) throw new CliError('API_ERROR', data.error, 'Check restoration API response');\nconst url = data.image || data.restored || (data.images?.[0]);\nif (!url) throw new CliError('EMPTY_RESPONSE', 'No result', 'Check the input image');","handlingStrategy":"validation","validationCode":"const ok = await fetch(kwargs.image, { method: 'HEAD' });\nif (!ok.ok) throw new Error(`input image not reachable: ${ok.status}`);\nconst type = ok.headers.get('content-type') || '';\nif (!type.startsWith('image/')) throw new Error(`not an image: ${type}`);","typeGuard":"function hasRestoredImage(d) {\n  return d != null && (typeof d.image === 'string' || (Array.isArray(d.images) && typeof d.images[0] === 'string'));\n}","tryCatchPattern":"try {\n  const rows = await opencli.yollomi.restore({ image: url });\n} catch (e) {\n  if (e.code === 'EMPTY_RESPONSE') {\n    // try a higher-quality source image, or retry once for transient failures\n    console.error(`${e.message}: ${e.hint}`);\n  } else throw e;\n}","preventionTips":["Provide the best-quality source photo available; heavily degraded scans may yield nothing","Use a public, stable URL (not expired signed links or local paths)","HEAD-check the URL before running","Retry once — restoration can fail transiently server-side"],"tags":["empty-response","api","cli","photo-restoration"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}