{"record":{"id":"7cf7be47001fe9f7","repo":"go-delve/delve","slug":"unrecognized-option-q","errorCode":null,"errorMessage":"unrecognized option %q","messagePattern":"unrecognized option %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":3499,"sourceCode":"}\n\nfunc transcript(t *Term, ctx callContext, args string) error {\n\targv := strings.SplitN(args, \" \", -1)\n\ttruncate := false\n\tfileOnly := false\n\tdisable := false\n\tpath := \"\"\n\tfor _, arg := range argv {\n\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","sourceCodeStart":3481,"sourceCodeEnd":3517,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L3481-L3517","documentation":"`display -save <path>` parses its arguments as flags (`-t` for truncate, `-off` to disable) plus one optional path. An argument starting with `-` that is not a known flag — or a second path after one was already given — is rejected as an unrecognized option.","triggerScenarios":"Running `display -save --foo path`, `display -save -x`, or giving two paths like `display -save a.txt b.txt` (second non-flag arg when path already set).","commonSituations":"Using GNU-style long flags (`--truncate`) that Delve doesn't support; typo'd flags; passing extra filename arguments. Note also that a path starting with `-` will be misread as a flag.","solutions":["Use only `-t` (truncate) or `-off` (disable) flags before the path","Provide exactly one path that does not begin with `-`","Check flag spelling/case (single dash, short form)"],"exampleFix":"// before\ndisplay -save --truncate /tmp/displays.txt\n// after\ndisplay -save -t /tmp/displays.txt","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"for _, a := range args {\n    if strings.HasPrefix(a, \"-\") && a != \"-t\" && a != \"-off\" {\n        return fmt.Errorf(\"unsupported flag %q for display -save\", a)\n    }\n}","preventionTips":["Pre-parse and reject unknown flags before invoking the command"],"tags":["terminal","display","cli"],"backgroundTag":"invalid-command-option","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}