jackwener/OpenCLI · error · ArgumentError

Unsupported --formats value(s): ${unknown.join(', ')}

Error message

Unsupported --formats value(s): ${unknown.join(', ')}

What it means

parseFormats validates the `--formats` flag against a whitelist (mp3, m4a, wav, video, cover, metadata). Any value outside SUPPORTED_FORMATS raises ArgumentError listing the rejected values plus the supported set. Stems are explicitly not supported yet because they need multi-step extraction.

Source

Thrown at clis/suno/utils.js:42

export const STUDIO_API = 'https://studio-api-prod.suno.com';
export const SUNO_CDN = 'https://cdn1.suno.ai';

// As of 2026-05, the UI exposes V5.5 (chirp-fenix) and V4.5+ (chirp-bluejay).
// Older versions are still routable via the API and remain valid `mv` values.
export const SUNO_MODELS = ['chirp-fenix', 'chirp-bluejay', 'chirp-v4', 'chirp-v3-5'];
export const DEFAULT_SUNO_MODEL = 'chirp-fenix';

export const SUPPORTED_FORMATS = ['mp3', 'm4a', 'wav', 'video', 'cover', 'metadata'];
export const DEFAULT_FORMATS = ['mp3', 'metadata'];

export function parseFormats(value) {
    if (value === undefined || value === null || value === '') return DEFAULT_FORMATS.slice();
    const raw = Array.isArray(value) ? value.join(',') : String(value);
    const parts = raw.split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
    if (!parts.length) return DEFAULT_FORMATS.slice();
    const unknown = parts.filter(p => !SUPPORTED_FORMATS.includes(p));
    if (unknown.length) {
        throw new ArgumentError(
            `Unsupported --formats value(s): ${unknown.join(', ')}`,
            `Supported: ${SUPPORTED_FORMATS.join(', ')}. (stems require multi-step extraction and are not yet wired.)`,
        );
    }
    return Array.from(new Set(parts));
}

export function resolveSunoOutputDir(value) {
    const raw = String(value || '').trim();
    if (!raw) return path.join(process.env.HOME || '~', 'Music', 'suno');
    if (raw === '~') return process.env.HOME || '~';
    if (raw.startsWith('~/')) return path.join(process.env.HOME || '~', raw.slice(2));
    return path.resolve(raw);
}

export function sanitizeTitleForFilename(title, fallback = 'untitled') {
    const cleaned = String(title || fallback)
        .replace(/[\\/:*?"<>|\x00-\x1f]+/g, '-')

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Replace the unsupported value with one from the whitelist: mp3, m4a, wav, video, cover, metadata.
  2. Check the error's second line — it prints the currently supported set.
  3. Remove 'stems' from the list; stem extraction is not wired yet in this CLI version.
  4. Update the CLI if you believe a format should be supported — newer versions may extend SUPPORTED_FORMATS.

Example fix

// before
suno generate --prompt "song" --formats mp3,stems
// after
suno generate --prompt "song" --formats mp3,m4a
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['mp3','m4a','wav','video','cover','metadata'];
const requested = String(formats || '').split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
const bad = requested.filter(f => !SUPPORTED.includes(f));
if (bad.length) throw new Error(`Unsupported formats: ${bad.join(', ')}. Supported: ${SUPPORTED.join(', ')}`);

Type guard

function isSupportedFormat(f) {
  return ['mp3','m4a','wav','video','cover','metadata'].includes(f);
}

Try / catch

try {
  await run({ formats: parseFormats(userFormats) });
} catch (err) {
  if (err.name === 'ArgumentError' && /Unsupported --formats/.test(err.message)) {
    console.warn('Falling back to default formats: mp3,metadata');
  } else throw err;
}

Prevention

When it happens

Trigger: Passing `--formats` with a value not in ['mp3','m4a','wav','video','cover','metadata'] — e.g. `--formats stems`, `--formats flac`, a typo like `--formats mp4`, or a comma list where at least one token is unknown. Values are trimmed and lowercased first, so 'MP3' is fine.

Common situations: Assuming stems download is supported; typing 'mp4' instead of 'video'; using format names from another tool (flac, ogg); passing a comma list with one bad token which fails the whole list.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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