{"record":{"id":"7a2eb1261feb9c9a","repo":"go-delve/delve","slug":"o-option-specified-with-an-output-path","errorCode":null,"errorMessage":"-o option specified with an output path","messagePattern":"-o option specified with an output path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":3508,"sourceCode":"\t\tswitch arg {\n\t\tcase \"-x\":\n\t\t\tfileOnly = true\n\t\tcase \"-t\":\n\t\t\ttruncate = true\n\t\tcase \"-off\":\n\t\t\tdisable = true\n\t\tdefault:\n\t\t\tif path != \"\" || strings.HasPrefix(arg, \"-\") {\n\t\t\t\treturn fmt.Errorf(\"unrecognized option %q\", arg)\n\t\t\t} else {\n\t\t\t\tpath = arg\n\t\t\t}\n\t\t}\n\t}\n\n\tif disable {\n\t\tif path != \"\" {\n\t\t\treturn errors.New(\"-o option specified with an output path\")\n\t\t}\n\t\treturn t.stdout.CloseTranscript()\n\t}\n\n\tif path == \"\" {\n\t\treturn errors.New(\"no output path specified\")\n\t}\n\n\tflags := os.O_APPEND | os.O_WRONLY | os.O_CREATE\n\tif truncate {\n\t\tflags |= os.O_TRUNC\n\t}\n\tfh, err := os.OpenFile(path, flags, 0660)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := t.stdout.CloseTranscript(); err != nil {","sourceCodeStart":3490,"sourceCodeEnd":3526,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L3490-L3526","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Either disable the transcript without a path, or keep the path and omit the disable flag.","To stop transcripting: run the command with only the disable option.","To write a transcript: run the command with just '-o <path>' (no disable flag)."],"exampleFix":"// before\nsave -x -o /tmp/transcript.txt\n// after\nsave -x\n// or, to write a transcript:\nsave -o /tmp/transcript.txt","handlingStrategy":"validation","validationCode":"if disable && path != \"\" { return errors.New(\"cannot combine disable flag with -o path\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide between closing the transcript and starting a new one; they are separate commands.","Never pass an output path together with the disable flag.","Script flag parsing to reject conflicting options early."],"tags":["cli","conflicting-options","delve"],"backgroundTag":"conflicting-command-options","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}