{"record":{"id":"1735ccc26f50ac87","repo":"jackwener/OpenCLI","slug":"invalid-model","errorCode":"INVALID_MODEL","errorMessage":"INVALID_MODEL","messagePattern":"INVALID_MODEL","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/generate.js","lineNumber":44,"sourceCode":"    description: 'Generate images with AI (text-to-image or image-to-image)',\n    domain: YOLLOMI_DOMAIN,\n    strategy: Strategy.COOKIE,\n    args: [\n        { name: 'prompt', positional: true, required: true, help: 'Text prompt describing the image' },\n        { name: 'model', default: 'z-image-turbo', help: 'Model ID (z-image-turbo, flux-schnell, nano-banana, flux-2-pro, ...)' },\n        { name: 'ratio', default: '1:1', choices: ['1:1', '16:9', '9:16', '4:3', '3:4'], help: 'Aspect ratio' },\n        { name: 'image', help: 'Input image URL for image-to-image (upload via \"opencli yollomi upload\" first)' },\n        { name: 'output', default: './yollomi-output', help: 'Output directory' },\n        { name: 'no-download', type: 'boolean', default: false, help: 'Only show URLs, skip download' },\n    ],\n    columns: ['index', 'status', 'file', 'size', 'url'],\n    func: async (page, kwargs) => {\n        const prompt = kwargs.prompt;\n        const modelId = kwargs.model;\n        const ratio = kwargs.ratio;\n        const apiPath = MODEL_ROUTES[modelId];\n        if (!apiPath)\n            throw new CliError('INVALID_MODEL', `Unknown model: ${modelId}`, 'Run \"opencli yollomi models --type image\" to see available models');\n        let body;\n        if (modelId === 'z-image-turbo') {\n            const { width, height } = getDimensions(ratio);\n            body = { prompt, width, height, output_format: 'jpg', output_quality: 85, guidance_scale: 0, num_inference_steps: 8 };\n        }\n        else if (modelId === 'flux-2-pro') {\n            body = { prompt, aspectRatio: ratio, outputNumber: 1 };\n            if (kwargs.image)\n                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 {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/generate.js#L26-L62","documentation":"The yollomi generate command throws INVALID_MODEL when the `--model` value has no entry in the MODEL_ROUTES lookup table. Each supported model maps to a specific API path; an unknown id cannot be routed, so the CLI fails fast before building a request body.","triggerScenarios":"Running `opencli yollomi generate --model <id>` where <id> is misspelled, renamed, deprecated, or simply not in MODEL_ROUTES (e.g. 'flux-pro' instead of 'flux-2-pro', or a text-model id passed to the image generator).","commonSituations":"Typos in the model id; copying a model name from a different CLI or the website UI; the site added new models the CLI's MODEL_ROUTES does not know (outdated CLI version).","solutions":["Run `opencli yollomi models --type image` to list valid model ids (per the error hint)","Fix the typo in --model to exactly match a listed id","Update the CLI if the site has newer models not yet in MODEL_ROUTES","Add the model to MODEL_ROUTES with the correct /api/ai/... route if maintaining the CLI"],"exampleFix":"// before\nopencli yollomi generate --model flux-pro \"a cat\"\n// error: Unknown model: flux-pro\n// after\nopencli yollomi models --type image   # shows e.g. flux-2-pro, z-image-turbo\nopencli yollomi generate --model flux-2-pro \"a cat\"","handlingStrategy":"validation","validationCode":"const VALID_MODELS = ['z-image-turbo', 'flux-2-pro' /* from: opencli yollomi models --type image */];\nif (!VALID_MODELS.includes(model)) throw new Error(`Unknown model: ${model}. Run: opencli yollomi models --type image`);","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await opencli.yollomi.generate({ prompt, model });\n} catch (e) {\n  if (e.code === 'INVALID_MODEL') {\n    const models = await opencli.yollomi.models({ type: 'image' });\n    console.error(`${e.message}. Available: ${models.map(m => m.id).join(', ')}`);\n  } else throw e;\n}","preventionTips":["List models with `opencli yollomi models --type image` before using --model","Copy model ids exactly from that list; do not guess site UI names","Keep the CLI updated so MODEL_ROUTES includes newly added models","Validate model ids in wrapper scripts before invoking"],"tags":["invalid-model","config","cli","validation"],"backgroundTag":"invalid-model-id","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}