{"record":{"id":"e9527fec4dfea0b5","repo":"go-delve/delve","slug":"unknown-command-target-s","errorCode":null,"errorMessage":"unknown command 'target %s'","messagePattern":"unknown command 'target (.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":3602,"sourceCode":"\t\tpid, err := strconv.Atoi(argv[1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfound := false\n\t\tfor _, tgt := range tgts {\n\t\t\tif tgt.Pid == pid {\n\t\t\t\tfound = true\n\t\t\t\tt.client.SwitchThread(tgt.CurrentThread.ID)\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"could not find target %d\", pid)\n\t\t}\n\t\treturn nil\n\tcase \"\":\n\t\treturn errors.New(\"not enough arguments for 'target'\")\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown command 'target %s'\", argv[0])\n\t}\n}\n\nfunc formatBreakpointName(bp *api.Breakpoint, upcase bool) string {\n\tthing := \"breakpoint\"\n\tif bp.Tracepoint {\n\t\tthing = \"tracepoint\"\n\t}\n\tif bp.WatchExpr != \"\" {\n\t\tthing = \"watchpoint\"\n\t}\n\tif upcase {\n\t\tthing = strings.ToUpper(string(thing[0])) + thing[1:]\n\t}\n\tid := bp.Name\n\tif id == \"\" {\n\t\tid = strconv.Itoa(bp.ID)\n\t}","sourceCodeStart":3584,"sourceCodeEnd":3620,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L3584-L3620","documentation":"`target` supports only the subcommands `follow-exec`, `switch`, or nothing. Any other first token falls into the default case and produces this error naming the unknown subcommand.","triggerScenarios":"Running e.g. `target list`, `target 4242`, or any misspelled subcommand at the Delve prompt.","commonSituations":"Guessing subcommand names (`list`, `show`, `select`); abbreviating `follow-exec` incorrectly; expecting `target <pid>` to switch directly instead of `target switch <pid>`.","solutions":["Use `target switch <pid>` to switch targets","Use `target follow-exec [-on|-off|-regex <pattern>]` to control exec following","Run `help target` to see valid subcommands"],"exampleFix":"// before\ntarget 4242\n// after\ntarget switch 4242","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"switch sub {\ncase \"follow-exec\", \"switch\", \"\":\n    // proceed\ndefault:\n    return fmt.Errorf(\"unknown target subcommand %q\", sub)\n}","preventionTips":["Dispatch on a fixed subcommand whitelist in automation"],"tags":["terminal","cli","subcommand"],"backgroundTag":"unknown-subcommand","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}