{"record":{"id":"3d2a4d3e84b17088","repo":"mislav/hub","slug":"please-type-yes-for-confirmation","errorCode":null,"errorMessage":"Please type 'yes' for confirmation.","messagePattern":"Please type 'yes' for confirmation\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/delete.go","lineNumber":80,"sourceCode":"\towner := host.User\n\tif strings.Contains(repoName, \"/\") {\n\t\tsplit := strings.SplitN(repoName, \"/\", 2)\n\t\towner, repoName = split[0], split[1]\n\t}\n\n\tproject := github.NewProject(owner, repoName, host.Host)\n\tgh := github.NewClient(project.Host)\n\n\tif !args.Flag.Bool(\"--yes\") {\n\t\tui.Printf(\"Really delete repository '%s' (yes/N)? \", project)\n\t\tanswer := \"\"\n\t\tscanner := bufio.NewScanner(os.Stdin)\n\t\tif scanner.Scan() {\n\t\t\tanswer = strings.TrimSpace(scanner.Text())\n\t\t}\n\t\tutils.Check(scanner.Err())\n\t\tif answer != \"yes\" {\n\t\t\tutils.Check(fmt.Errorf(\"Please type 'yes' for confirmation.\"))\n\t\t}\n\t}\n\n\tif args.Noop {\n\t\tui.Printf(\"Would delete repository '%s'.\\n\", project)\n\t} else {\n\t\terr = gh.DeleteRepository(project)\n\t\tif err != nil && strings.Contains(err.Error(), \"HTTP 403\") {\n\t\t\tui.Errorf(\"Please edit the token used for hub at https://%s/settings/tokens\\n\", project.Host)\n\t\t\tui.Errorln(\"and verify that the `delete_repo` scope is enabled.\")\n\t\t}\n\t\tutils.Check(err)\n\t\tui.Printf(\"Deleted repository '%s'.\\n\", project)\n\t}\n\n\targs.NoForward()\n}\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/delete.go#L62-L98","documentation":"In commands/delete.go deleteRepo, the destructive delete requires an interactive confirmation. The typed answer (trimmed) must be exactly \"yes\"; anything else raises \"Please type 'yes' for confirmation.\" to abort repository deletion.","triggerScenarios":"At the confirmation prompt for `hub delete-repository`, entering anything other than the literal string `yes` after TrimSpace (e.g. `y`, `Y`, `YES`, `yes ` variants already handled, empty Enter, or EOF from a non-interactive stdin where scanner.Scan() reads nothing).","commonSituations":"Piping input into the command with a word other than `yes`; running in CI where stdin is empty so answer stays empty; users instinctively typing `y` or `YES`; locale keyboard issues.","solutions":["Type exactly `yes` (lowercase) at the prompt and press Enter.","When scripting, echo the exact confirmation: `echo yes | hub delete-repository ...` (interactive prompts may still refuse; prefer running interactively).","Use a --no/--noop-style dry run first to review what would be deleted before confirming."],"exampleFix":"// before\n$ hub delete-repository user/proj\nReally delete? y     // Please type 'yes' for confirmation.\n// after\n$ hub delete-repository user/proj\nReally delete? yes","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"answer := strings.TrimSpace(readLine())\nif answer != \"yes\" {\n    fmt.Println(\"aborted: repository not deleted\")\n    os.Exit(1)\n}","preventionTips":["Type the literal lowercase `yes`, not `y` or `YES`","Run destructive commands interactively rather than piping stdin","In CI, use an explicit non-interactive/force flag instead of echoing prompts","Dry-run (e.g. --noop) first before confirming deletions"],"tags":["cli","confirmation","destructive-operation"],"backgroundTag":"confirmation-prompt-mismatch","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}