google-gemini/gemini-cli · error · FatalInputError

Exiting due to a confirmation prompt requested by the comman

Error message

Exiting due to a confirmation prompt requested by the command.

What it means

Thrown when a slash command run in non-interactive mode returns a result of type 'confirm_shell_commands'. It is a FatalInputError (exit code 42). Non-interactive mode has no UI to present a confirmation prompt, so any command that requests shell-command confirmation aborts. (Note: ShellTool is normally excluded in non-interactive mode unless YOLO is active, so this is largely defensive.)

Source

Thrown at packages/cli/src/nonInteractiveCliCommands.ts:100

          name: commandToExecute.name,
          args,
        },
      };

      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

  1. Enable YOLO mode (which bypasses shell confirmation) if it is safe to do so for that run.
  2. Run the command in interactive mode where the confirmation prompt can be displayed.
  3. Adjust the command/policy so it does not require confirmation in non-interactive contexts (add the command to the session shell allowlist or an allow policy).

Example fix

# before (aborts in non-interactive)
gemini -p "/my-cmd"
# after — allow without prompt, or run interactively
gemini --yolo -p "/my-cmd"
# or
gemini   # then run /my-cmd interactively
Defensive patterns

Strategy: validation

Validate before calling

function safeForNonInteractive(resultType: string): boolean {
  return resultType === 'submit_prompt';
}
// before launching non-interactive, ensure the command does not return 'confirm_shell_commands'

Type guard

function isConfirmResult(r: { type: string }): boolean {
  return r.type === 'confirm_shell_commands';
}

Try / catch

try {
  await runNonInteractive();
} catch (e) {
  if (e instanceof FatalInputError && /confirmation prompt/.test(e.message)) {
    // exit code 42: enable YOLO or run interactively
  }
  throw e;
}

Prevention

When it happens

Trigger: A built-in/custom slash command emits a confirm_shell_commands result during a `gemini -p` / non-interactive run, where no interactive prompt can be shown.

Common situations: Running a custom command that asks for shell confirmation in a pipeline/CI; a future granular-permissions command that requests confirmation without YOLO enabled.

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/11214f2c557eca70. Report an issue: GitHub.