diff --git a/src/cli/commands/run/command.tsx b/src/cli/commands/run/command.tsx index db036ce8d..fcea6b2f2 100644 --- a/src/cli/commands/run/command.tsx +++ b/src/cli/commands/run/command.tsx @@ -398,13 +398,17 @@ export const registerRun = (program: Command) => { if (!cliOptions.json) console.log(message); }; + if (cliOptions.name?.trim() === '') { + throw new ValidationError('--name must not be empty. Omit the flag to auto-generate a name.'); + } + await runCliCommand('run.job', !!cliOptions.json, async () => { const engine = createJobEngine(new ConfigIO()); const insightIds = cliOptions.insights ?? ['Builtin.Insight.FailureAnalysis']; const lookbackDays = cliOptions.lookbackDays ? parseInt(cliOptions.lookbackDays, 10) : undefined; if (lookbackDays !== undefined && (isNaN(lookbackDays) || lookbackDays < 1 || lookbackDays > 90)) { - throw new Error('--lookback-days must be between 1 and 90'); + throw new ValidationError('--lookback-days must be a positive integer between 1 and 90.'); } const startResult = await engine.start('insights', {