pulumi/pulumi · info

no log file selected

Error message

no log file selected

What it means

In the interactive picker (pkg/cmd/pulumi/logs/remove.go:200), survey.AskOne renders a select list of log files. If AskOne returns an error — the user presses Ctrl+C/Esc, or the prompt fails — the code deliberately discards the survey error and returns the generic message 'no log file selected', signaling that no choice was made.

Source

Thrown at pkg/cmd/pulumi/logs/remove.go:200

func chooseLogToRemove(logsDir string) (logEntry, error) {
	entries, err := listLogs(logsDir)
	if err != nil {
		return logEntry{}, err
	}
	if len(entries) == 0 {
		return logEntry{}, fmt.Errorf("no log files found in %s", logsDir)
	}

	options, optionMap := formatLogRemovalChoices(entries)

	var choice string
	if err := survey.AskOne(&survey.Select{
		Message:  "Select a log file to remove:",
		Options:  options,
		PageSize: cmd.OptimalPageSize(cmd.OptimalPageSizeOpts{Nopts: len(options)}),
	}, &choice, ui.SurveyIcons(cmdutil.GetGlobalColorization())); err != nil {
		return logEntry{}, errors.New("no log file selected")
	}

	selected := optionMap[choice]
	for _, e := range entries {
		if e.path == selected {
			return e, nil
		}
	}
	return logEntry{}, errors.New("internal error: selected log not found")
}

func printRemovalTable(out io.Writer, entries []logEntry) {
	rows := slice.Prealloc[cmdutil.TableRow](len(entries))
	for _, e := range entries {
		stack := e.stackDisplay()
		updateID := e.updateID
		if updateID == "" {
			updateID = "—"

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Re-run `pulumi logs remove` and complete the selection
  2. Use non-interactive flags instead: --all, --stack <name>, or --before <value>
  3. Run in a real TTY if stdin/stdout were redirected
  4. Press Ctrl+C deliberately to cancel — this error is the expected cancellation path

Example fix

# before
pulumi logs remove < /dev/null   # survey fails -> 'no log file selected'
# after
pulumi logs remove --stack dev --yes
Defensive patterns

Strategy: fallback

Validate before calling

# ensure a TTY is available before interactive commands
[ -t 0 ] && [ -t 1 ] || pulumi logs remove --all --yes

Try / catch

# shell
pulumi logs remove || pulumi logs remove --all --yes   # fall back on cancel/failure
# Go (auto SDK wrapper)
if err := run(); err != nil && strings.Contains(err.Error(), "no log file selected") {
    return runWithFlags()
}

Prevention

When it happens

Trigger: Pressing Ctrl+C or Esc at the 'Select a log file to remove:' prompt; the survey library failing to read from stdin/stdout (redirected or too-small terminal) while the CLI still considers the session interactive.

Common situations: User changes their mind mid-prompt and aborts; piping input into an interactive command so survey cannot present a proper TTY select prompt; terminal multiplexers intercepting the key.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/47c4f60514002ca5. Report an issue: GitHub.