jackwener/OpenCLI · error · CliError

INVALID_MODEL

INVALID_MODEL

Error message

INVALID_MODEL

What it means

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.

Source

Thrown at clis/yollomi/generate.js:44

    description: 'Generate images with AI (text-to-image or image-to-image)',
    domain: YOLLOMI_DOMAIN,
    strategy: Strategy.COOKIE,
    args: [
        { name: 'prompt', positional: true, required: true, help: 'Text prompt describing the image' },
        { name: 'model', default: 'z-image-turbo', help: 'Model ID (z-image-turbo, flux-schnell, nano-banana, flux-2-pro, ...)' },
        { name: 'ratio', default: '1:1', choices: ['1:1', '16:9', '9:16', '4:3', '3:4'], help: 'Aspect ratio' },
        { name: 'image', help: 'Input image URL for image-to-image (upload via "opencli yollomi upload" first)' },
        { name: 'output', default: './yollomi-output', help: 'Output directory' },
        { name: 'no-download', type: 'boolean', default: false, help: 'Only show URLs, skip download' },
    ],
    columns: ['index', 'status', 'file', 'size', 'url'],
    func: async (page, kwargs) => {
        const prompt = kwargs.prompt;
        const modelId = kwargs.model;
        const ratio = kwargs.ratio;
        const apiPath = MODEL_ROUTES[modelId];
        if (!apiPath)
            throw new CliError('INVALID_MODEL', `Unknown model: ${modelId}`, 'Run "opencli yollomi models --type image" to see available models');
        let body;
        if (modelId === 'z-image-turbo') {
            const { width, height } = getDimensions(ratio);
            body = { prompt, width, height, output_format: 'jpg', output_quality: 85, guidance_scale: 0, num_inference_steps: 8 };
        }
        else if (modelId === 'flux-2-pro') {
            body = { prompt, aspectRatio: ratio, outputNumber: 1 };
            if (kwargs.image)
                body.imageUrl = kwargs.image;
        }
        else if (modelId === 'flux-kontext-pro') {
            body = { prompt, output_format: 'jpg' };
            if (kwargs.image)
                body.imageUrl = kwargs.image;
            if (ratio !== '1:1')
                body.aspect_ratio = ratio;
        }
        else {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run `opencli yollomi models --type image` to list valid model ids (per the error hint)
  2. Fix the typo in --model to exactly match a listed id
  3. Update the CLI if the site has newer models not yet in MODEL_ROUTES
  4. Add the model to MODEL_ROUTES with the correct /api/ai/... route if maintaining the CLI

Example fix

// before
opencli yollomi generate --model flux-pro "a cat"
// error: Unknown model: flux-pro
// after
opencli yollomi models --type image   # shows e.g. flux-2-pro, z-image-turbo
opencli yollomi generate --model flux-2-pro "a cat"
Defensive patterns

Strategy: validation

Validate before calling

const VALID_MODELS = ['z-image-turbo', 'flux-2-pro' /* from: opencli yollomi models --type image */];
if (!VALID_MODELS.includes(model)) throw new Error(`Unknown model: ${model}. Run: opencli yollomi models --type image`);

Try / catch

try {
  const rows = await opencli.yollomi.generate({ prompt, model });
} catch (e) {
  if (e.code === 'INVALID_MODEL') {
    const models = await opencli.yollomi.models({ type: 'image' });
    console.error(`${e.message}. Available: ${models.map(m => m.id).join(', ')}`);
  } else throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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).

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1735ccc26f50ac87. Report an issue: GitHub.