{"record":{"id":"3bddb5a8b59b81b0","repo":"jackwener/OpenCLI","slug":"empty-response-3bddb5","errorCode":"EMPTY_RESPONSE","errorMessage":"EMPTY_RESPONSE","messagePattern":"EMPTY_RESPONSE","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/try-on.js","lineNumber":35,"sourceCode":"        { name: 'person', required: true, help: 'Person photo URL (upload via \"opencli yollomi upload\" first)' },\n        { name: 'cloth', required: true, help: 'Clothing image URL' },\n        { name: 'cloth-type', default: 'upper', choices: ['upper', 'lower', 'overall'], help: 'Clothing type' },\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('Processing virtual try-on...');\n        const data = await yollomiPost(page, '/api/ai/virtual-try-on', {\n            person_image: kwargs.person,\n            cloth_image: kwargs.cloth,\n            cloth_type: kwargs['cloth-type'],\n            output_format: 'png',\n            output_quality: 100,\n        });\n        const url = data.image || (data.images?.[0]);\n        if (!url)\n            throw new CliError('EMPTY_RESPONSE', 'No result', 'Check both images have clear subjects');\n        if (kwargs['no-download'])\n            return [{ status: 'generated', file: '-', size: '-', url }];\n        try {\n            const filename = `yollomi_tryon_${Date.now()}.png`;\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":17,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/try-on.js#L17-L48","documentation":"The yollomi try-on command throws EMPTY_RESPONSE when the virtual try-on endpoint returns no generated image. The code checks data.image then data.images[0]; if neither exists, no try-on result was produced and the command aborts.","triggerScenarios":"POSTing the person/garment image pair with cloth_type, output_format 'png', output_quality 100 yields a 200 body without image fields — images unreadable server-side, unsupported cloth_type, or schema change.","commonSituations":"Garment image with cluttered background so no clear subject detected; person image where clothing is occluded; --cloth-type value not accepted by the endpoint; expired/unfetchable image URLs.","solutions":["Use images with clear, unoccluded subjects (per the hint)","Verify --cloth-type matches a supported value (e.g. upper/lower/overall)","Ensure both image URLs are publicly accessible and valid formats","Log the raw response to check for swallowed error fields","Update extraction logic if the API response schema changed"],"exampleFix":"// before\nconst url = data.image || (data.images?.[0]);\nif (!url) throw new CliError('EMPTY_RESPONSE', 'No result', 'Check both images have clear subjects');\n// after\nif (data.error) throw new CliError('API_ERROR', data.error, 'Check try-on API response');\nconst url = data.image || data.output || (data.images?.[0]);\nif (!url) throw new CliError('EMPTY_RESPONSE', 'No result', 'Check both images have clear subjects');","handlingStrategy":"validation","validationCode":"const CLOTH_TYPES = ['upper', 'lower', 'overall' /* verify via docs/models list */];\nif (!CLOTH_TYPES.includes(kwargs['cloth-type'])) throw new Error(`unsupported cloth-type: ${kwargs['cloth-type']}`);\nfor (const u of [kwargs.person, kwargs.cloth]) if (!(await fetch(u, { method: 'HEAD' })).ok) throw new Error(`image not reachable: ${u}`);","typeGuard":"function hasTryOnImage(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['try-on']({ person, cloth, 'cloth-type': 'upper' });\n} catch (e) {\n  if (e.code === 'EMPTY_RESPONSE') {\n    console.error(`${e.message}: ${e.hint} — use clear, unoccluded subject photos`);\n  } else throw e;\n}","preventionTips":["Use person photos where the target clothing area is fully visible and unoccluded","Use garment images with clean, plain backgrounds","Pass a supported --cloth-type value","HEAD-check both image URLs before invoking"],"tags":["empty-response","api","cli","virtual-tryon"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}