affaan-m/ECC · error · Error
Invalid format: ${parsed.format}. Use text or json.
Error message
Invalid format: ${parsed.format}. Use text or json. What it means
Thrown after argument parsing completes if parsed.format is neither 'text' nor 'json'. The script only emits human-readable text or machine-readable JSON, and any other format value is rejected before any work runs.
Source
Thrown at scripts/release-video-suite.js:430
continue;
}
if (arg === '--suite-root') {
parsed.suiteRoot = path.resolve(readArgValue(args, index, arg));
index += 1;
continue;
}
if (arg.startsWith('--suite-root=')) {
parsed.suiteRoot = path.resolve(arg.slice('--suite-root='.length));
continue;
}
throw new Error(`Unknown argument: ${arg}`);
}
if (!['text', 'json'].includes(parsed.format)) {
throw new Error(`Invalid format: ${parsed.format}. Use text or json.`);
}
return parsed;
}
function readText(rootDir, relativePath) {
try {
return fs.readFileSync(path.join(rootDir, relativePath), 'utf8');
} catch (_error) {
return '';
}
}
function safeParseJson(text) {
if (!text.trim()) {
return null;
}
View on GitHub (pinned to 01e15490f0)
Solutions
- Use `--format text` (default) for human output.
- Use `--format json` for machine consumption.
- Drop the --format flag entirely to accept the text default.
- Verify the format pipeline you intend to consume actually exists upstream.
Example fix
# before node scripts/release-video-suite.js --format yaml # after node scripts/release-video-suite.js --format json
Defensive patterns
Strategy: validation
Validate before calling
const FORMATS = new Set(['text', 'json']);
const fmt = (process.argv.find(a => a.startsWith('--format')) || '').split('=')[1] || 'text';
if (!FORMATS.has(fmt.toLowerCase())) { console.error(`Unsupported format: ${fmt}`); process.exit(2); } Try / catch
try { parseArgs(process.argv); } catch (err) { if (err.message.startsWith('Invalid format')) { /* hint at allowed values */ } throw err; } Prevention
- Treat the format set as a single source of truth and validate before dispatch.
- Default to 'text' when the flag is omitted to avoid accidental invalid values.
When it happens
Trigger: Passing `--format yaml`, `--format xml`, `--format=md`, or an empty value. The value is lowercased before the check, so case is not the cause.
Common situations: Assuming the suite supports a format from a different tool; copy-pasting a format flag from a templating pipeline; fat-fingering the format name.
Related errors
- Invalid format: ${parsed.format}. Use text, json, or markdow
- ${flagName} requires a value
- Unknown argument: ${arg}
- --write requires a path
- Unknown argument: ${arg}
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/37bb44e15a6403d9.
Report an issue: GitHub.