{"record":{"id":"2efc3460420d9995","repo":"go-delve/delve","slug":"missing-filename-after-save-flag","errorCode":null,"errorMessage":"missing filename after -save flag","messagePattern":"missing filename after -save flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":1698,"sourceCode":"\tfmt.Fprintf(t.stdout, \"%s toggled at %s\\n\", formatBreakpointName(bp, true), t.formatBreakpointLocation(bp))\n\treturn nil\n}\n\nfunc breakpoints(t *Term, ctx callContext, args string) error {\n\t// Parse arguments\n\tvar showAll bool\n\tvar saveFile string\n\n\tif args != \"\" {\n\t\targv := strings.Fields(args)\n\targsLoop:\n\t\tfor i, arg := range argv {\n\t\t\tswitch arg {\n\t\t\tcase \"-a\":\n\t\t\t\tshowAll = true\n\t\t\tcase \"-save\":\n\t\t\t\tif i+1 >= len(argv) {\n\t\t\t\t\treturn errors.New(\"missing filename after -save flag\")\n\t\t\t\t}\n\t\t\t\tsaveFile = argv[i+1]\n\t\t\t\tbreak argsLoop // Exit loop since we found -save and its argument\n\t\t\t}\n\t\t}\n\t}\n\n\tbreakPoints, err := t.client.ListBreakpoints(showAll)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If -save flag is provided, save breakpoints to file\n\tif saveFile != \"\" {\n\t\tfile, err := os.Create(saveFile)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to open file '%s': %w\", saveFile, err)\n\t\t}","sourceCodeStart":1680,"sourceCodeEnd":1716,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L1680-L1716","documentation":"The 'breakpoints' (or related listing) command supports a '-save <file>' flag that writes the breakpoint list to a file. This error is returned when '-save' is the last argument so no filename follows it, detected by the `i+1 >= len(argv)` check.","triggerScenarios":"Running 'breakpoints -save' without a trailing filename: the argsLoop sees '-save' at the last position and returns the error (pkg/terminal/command.go:1698).","commonSituations":"Truncated commands from shell history or scripts; forgetting that -save consumes the next token as the filename; quoting issues that swallow the filename argument.","solutions":["Provide a filename: 'breakpoints -save breakpoints.json'","Quote paths containing spaces: '-save \"/path/with spaces/bps.json\"'","Check 'help breakpoints' for flag ordering"],"exampleFix":"// before\nbreakpoints -save\n// after\nbreakpoints -save bps.json","handlingStrategy":"validation","validationCode":"i := slices.Index(argv, \"-save\")\nif i != -1 && i+1 >= len(argv) {\n\treturn errors.New(\"-save requires a filename argument\")\n}","typeGuard":null,"tryCatchPattern":"if err := breakpointsCmd(...); err != nil && strings.Contains(err.Error(), \"missing filename after -save flag\") { /* re-run with an explicit filename */ }","preventionTips":["Always pass a filename immediately after -save","Quote paths containing spaces","Validate argv completeness in scripts before invoking"],"tags":["terminal","breakpoints","cli-usage","flags"],"backgroundTag":"missing-flag-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}