plandex-ai/plandex · error

failed to get user input: %s

Error message

failed to get user input: %s

What it means

GetRequiredUserStringInput wraps errors from GetUserStringInput (the cqroot/prompt input). The underlying prompt fails when the interactive input can't run — typically no TTY or terminal I/O error. Empty answers don't produce this error; they just re-prompt.

Source

Thrown at app/cli/term/prompt.go:16

package term

import (
	"fmt"
	"os"

	"github.com/cqroot/prompt"
	"github.com/cqroot/prompt/input"
	"github.com/eiannone/keyboard"
	"github.com/fatih/color"
)

func GetRequiredUserStringInput(msg string) (string, error) {
	res, err := GetUserStringInput(msg)
	if err != nil {
		return "", fmt.Errorf("failed to get user input: %s", err)
	}

	if res == "" {
		color.New(color.Bold, ColorHiRed).Println("🚨 This input is required")
		return GetRequiredUserStringInput(msg)
	}

	return res, nil
}

func GetUserStringInput(msg string) (string, error) {
	return GetUserStringInputWithDefault(msg, "")
}

func GetUserStringInputWithDefault(msg, def string) (string, error) {
	disableBracketedPaste()
	defer enableBracketedPaste()

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run the command in an interactive terminal with a real TTY
  2. If scripting, check whether the command supports flags/env vars to skip the prompt
  3. Ensure stdin is not closed/redirected from /dev/null unexpectedly
  4. Use `ssh -t` to force PTY allocation for remote sessions

Example fix

// before
echo "" | plandex checkout my-plan
// after
# run interactively, or supply non-interactive flags/env where supported
plandex checkout my-plan   # in a real TTY
Defensive patterns

Strategy: try-catch

Validate before calling

fi, _ := os.Stdin.Stat()
interactive := (fi.Mode() & os.ModeCharDevice) != 0
// if !interactive, avoid GetRequiredUserStringInput or provide value another way

Try / catch

res, err := term.GetRequiredUserStringInput("Org name:")
if err != nil {
    return fmt.Errorf("org prompt failed: %w", err) // usually no-TTY; surface clearly
}

Prevention

When it happens

Trigger: Called by promptSignInNewAccount, createOrg, checkout, invite, rename, updateConfig when stdin is not an interactive terminal (piped input, CI, no TTY) or the cqroot prompt library returns a non-quit error.

Common situations: Running commands in CI or scripts where stdin is redirected; SSH session without a PTY; IDE embedded terminals with odd TTY setups.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/cdb371ed88788b4f. Report an issue: GitHub.