google-gemini/gemini-cli · error · FatalInputError
Exiting due to command result that is not supported in non-i
Error message
Exiting due to command result that is not supported in non-interactive mode.
What it means
The default branch of the slash-command result switch in non-interactive mode: the command returned a result type that is not 'submit_prompt' or 'confirm_shell_commands'. It is a FatalInputError (exit code 42). Only prompt submission and (defensively) confirmation are supported outside interactive mode; any other result shape is rejected.
Source
Thrown at packages/cli/src/nonInteractiveCliCommands.ts:104
const result = await commandToExecute.action(commandContext, args);
if (result) {
switch (result.type) {
case 'submit_prompt':
return result.content;
case 'confirm_shell_commands':
// This result indicates a command attempted to confirm shell commands.
// However note that currently, ShellTool is excluded in non-interactive
// mode unless 'YOLO mode' is active, so confirmation actually won't
// occur because of YOLO mode.
// This ensures that if a command *does* request confirmation (e.g.
// in the future with more granular permissions), it's handled appropriately.
throw new FatalInputError(
'Exiting due to a confirmation prompt requested by the command.',
);
default:
throw new FatalInputError(
'Exiting due to command result that is not supported in non-interactive mode.',
);
}
}
}
}
return;
};
View on GitHub (pinned to 5024443c72)
Solutions
- Run that command in interactive mode where its result type is supported.
- Update the custom command to return 'submit_prompt' with content for non-interactive compatibility.
- Check the command's supported modes in its docs before using it in a pipeline.
Defensive patterns
Strategy: validation
Validate before calling
const NON_INTERACTIVE_RESULT_TYPES = new Set(['submit_prompt']);
function supportsNonInteractive(resultType: string): boolean {
return NON_INTERACTIVE_RESULT_TYPES.has(resultType);
} Type guard
function isSubmitPrompt(r: { type: string; content?: unknown }): boolean {
return r.type === 'submit_prompt' && typeof r.content !== 'undefined';
} Try / catch
try {
await runNonInteractive();
} catch (e) {
if (e instanceof FatalInputError && /not supported in non-interactive mode/.test(e.message)) {
// exit code 42: run this command interactively instead
}
throw e;
} Prevention
- Check a command's supported modes before using it in non-interactive runs.
- Design custom commands to return 'submit_prompt' for non-interactive compatibility.
- Keep UI-only commands out of CI pipelines.
When it happens
Trigger: A slash command returns a result object whose .type is something other than 'submit_prompt'/'confirm_shell_commands' while running non-interactively.
Common situations: A custom command designed for interactive UI flows (e.g. opening a picker, rendering a panel) is invoked via `gemini -p`; an upgraded command emits a new result type not yet handled in non-interactive mode.
Related errors
- Exiting due to an error processing the @ command.
- Exiting due to an error processing the @ command.
- Exiting due to a confirmation prompt requested by the comman
- Operation cancelled.
- Reached max session turns for this session. Increase the num
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/637551efbc8512a2.
Report an issue: GitHub.