{"record":{"id":"cdb371ed88788b4f","repo":"plandex-ai/plandex","slug":"failed-to-get-user-input-s","errorCode":null,"errorMessage":"failed to get user input: %s","messagePattern":"failed to get user input: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/term/prompt.go","lineNumber":16,"sourceCode":"package term\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/cqroot/prompt\"\n\t\"github.com/cqroot/prompt/input\"\n\t\"github.com/eiannone/keyboard\"\n\t\"github.com/fatih/color\"\n)\n\nfunc GetRequiredUserStringInput(msg string) (string, error) {\n\tres, err := GetUserStringInput(msg)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get user input: %s\", err)\n\t}\n\n\tif res == \"\" {\n\t\tcolor.New(color.Bold, ColorHiRed).Println(\"🚨 This input is required\")\n\t\treturn GetRequiredUserStringInput(msg)\n\t}\n\n\treturn res, nil\n}\n\nfunc GetUserStringInput(msg string) (string, error) {\n\treturn GetUserStringInputWithDefault(msg, \"\")\n}\n\nfunc GetUserStringInputWithDefault(msg, def string) (string, error) {\n\tdisableBracketedPaste()\n\tdefer enableBracketedPaste()\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/term/prompt.go#L1-L34","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running commands in CI or scripts where stdin is redirected; SSH session without a PTY; IDE embedded terminals with odd TTY setups.","solutions":["Run the command in an interactive terminal with a real TTY","If scripting, check whether the command supports flags/env vars to skip the prompt","Ensure stdin is not closed/redirected from /dev/null unexpectedly","Use `ssh -t` to force PTY allocation for remote sessions"],"exampleFix":"// before\necho \"\" | plandex checkout my-plan\n// after\n# run interactively, or supply non-interactive flags/env where supported\nplandex checkout my-plan   # in a real TTY","handlingStrategy":"try-catch","validationCode":"fi, _ := os.Stdin.Stat()\ninteractive := (fi.Mode() & os.ModeCharDevice) != 0\n// if !interactive, avoid GetRequiredUserStringInput or provide value another way","typeGuard":null,"tryCatchPattern":"res, err := term.GetRequiredUserStringInput(\"Org name:\")\nif err != nil {\n    return fmt.Errorf(\"org prompt failed: %w\", err) // usually no-TTY; surface clearly\n}","preventionTips":["Run commands in an interactive TTY","Check for flags/env vars that bypass prompts when scripting","Force PTY over SSH with ssh -t"],"tags":["go","cli","stdin","tty"],"backgroundTag":"no-tty-stdin","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}