go-delve/delve · error

-o option specified with an output path

Error message

-o option specified with an output path

What it means

The transcript command ('save') supports disabling the transcript with a '-o' style disable flag, but the disable mode and an explicit output path are mutually exclusive. If the user both requests closing/disabling the transcript and supplies a path, the command rejects the combination.

Source

Thrown at pkg/terminal/command.go:3508

		switch arg {
		case "-x":
			fileOnly = true
		case "-t":
			truncate = true
		case "-off":
			disable = true
		default:
			if path != "" || strings.HasPrefix(arg, "-") {
				return fmt.Errorf("unrecognized option %q", arg)
			} else {
				path = arg
			}
		}
	}

	if disable {
		if path != "" {
			return errors.New("-o option specified with an output path")
		}
		return t.stdout.CloseTranscript()
	}

	if path == "" {
		return errors.New("no output path specified")
	}

	flags := os.O_APPEND | os.O_WRONLY | os.O_CREATE
	if truncate {
		flags |= os.O_TRUNC
	}
	fh, err := os.OpenFile(path, flags, 0660)
	if err != nil {
		return err
	}

	if err := t.stdout.CloseTranscript(); err != nil {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Either disable the transcript without a path, or keep the path and omit the disable flag.
  2. To stop transcripting: run the command with only the disable option.
  3. To write a transcript: run the command with just '-o <path>' (no disable flag).

Example fix

// before
save -x -o /tmp/transcript.txt
// after
save -x
// or, to write a transcript:
save -o /tmp/transcript.txt
Defensive patterns

Strategy: validation

Validate before calling

if disable && path != "" { return errors.New("cannot combine disable flag with -o path") }

Prevention

When it happens

Trigger: Running the transcript/save command with the disable flag together with '-o <path>' or a path argument, e.g. combining a '-x'/disable option and an output file in one invocation.

Common situations: Users trying to close the current transcript while also redirecting to a new file in the same command, assuming the path would apply to a subsequent transcript.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/7a2eb1261feb9c9a. Report an issue: GitHub.