{"record":{"id":"2790b594b3eff005","repo":"go-delve/delve","slug":"you-must-provide-a-path-to-a-binary","errorCode":null,"errorMessage":"you must provide a path to a binary","messagePattern":"you must provide a path to a binary","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dlv/cmds/commands.go","lineNumber":289,"sourceCode":"\tmust(debugCommand.MarkFlagFilename(\"tty\"))\n\tdebugCommand.Flags().BoolVarP(&rrDelOnDetach, \"rr-cleanup\", \"\", true,\n\t\t\"Delete directory containing debug recording on detach.\")\n\trootCommand.AddCommand(debugCommand)\n\n\t// 'exec' subcommand.\n\texecCommand := &cobra.Command{\n\t\tUse:   \"exec <path/to/binary>\",\n\t\tShort: \"Execute a precompiled binary, and begin a debug session.\",\n\t\tLong: `Execute a precompiled binary and begin a debug session.\n\nThis command will cause Delve to exec the binary and immediately attach to it to\nbegin a new debug session. Please note that if the binary was not compiled with\noptimizations disabled, it may be difficult to properly debug it. Please\nconsider compiling debugging binaries with -gcflags=\"all=-N -l\" on Go 1.10\nor later, -gcflags=\"-N -l\" on earlier versions of Go.`,\n\t\tPersistentPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn errors.New(\"you must provide a path to a binary\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tos.Exit(execute(0, args, conf, \"\", debugger.ExecutingExistingFile, args, buildFlags))\n\t\t},\n\t\tValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\t\tif len(args) != 0 {\n\t\t\t\treturn nil, cobra.ShellCompDirectiveNoFileComp\n\t\t\t}\n\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t},\n\t}\n\texecCommand.Flags().StringVar(&tty, \"tty\", \"\", \"TTY to use for the target program\")\n\tmust(execCommand.MarkFlagFilename(\"tty\"))\n\texecCommand.Flags().BoolVar(&continueOnStart, \"continue\", false, \"Continue the debugged process on start.\")\n\texecCommand.Flags().BoolVarP(&rrDelOnDetach, \"rr-cleanup\", \"\", true,\n\t\t\"Delete directory containing debug recording on detach.\")","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/cmd/dlv/cmds/commands.go#L271-L307","documentation":"Error \"you must provide a path to a binary\" thrown in go-delve/delve.","triggerScenarios":"Thrown at cmd/dlv/cmds/commands.go:289 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}