go-delve/delve · error
you must provide a path to a binary
Error message
you must provide a path to a binary
What it means
Error "you must provide a path to a binary" thrown in go-delve/delve.
Source
Thrown at cmd/dlv/cmds/commands.go:289
must(debugCommand.MarkFlagFilename("tty"))
debugCommand.Flags().BoolVarP(&rrDelOnDetach, "rr-cleanup", "", true,
"Delete directory containing debug recording on detach.")
rootCommand.AddCommand(debugCommand)
// 'exec' subcommand.
execCommand := &cobra.Command{
Use: "exec <path/to/binary>",
Short: "Execute a precompiled binary, and begin a debug session.",
Long: `Execute a precompiled binary and begin a debug session.
This command will cause Delve to exec the binary and immediately attach to it to
begin a new debug session. Please note that if the binary was not compiled with
optimizations disabled, it may be difficult to properly debug it. Please
consider compiling debugging binaries with -gcflags="all=-N -l" on Go 1.10
or later, -gcflags="-N -l" on earlier versions of Go.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("you must provide a path to a binary")
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
os.Exit(execute(0, args, conf, "", debugger.ExecutingExistingFile, args, buildFlags))
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
return nil, cobra.ShellCompDirectiveDefault
},
}
execCommand.Flags().StringVar(&tty, "tty", "", "TTY to use for the target program")
must(execCommand.MarkFlagFilename("tty"))
execCommand.Flags().BoolVar(&continueOnStart, "continue", false, "Continue the debugged process on start.")
execCommand.Flags().BoolVarP(&rrDelOnDetach, "rr-cleanup", "", true,
"Delete directory containing debug recording on detach.")View on GitHub (pinned to a23773e6c3)
When it happens
Trigger: Thrown at cmd/dlv/cmds/commands.go:289 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/2790b594b3eff005.
Report an issue: GitHub.