{"record":{"id":"67ec702af3866a1c","repo":"go-delve/delve","slug":"too-many-arguments-to-restart","errorCode":null,"errorMessage":"too many arguments to restart","messagePattern":"too many arguments to restart","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":1215,"sourceCode":"\trerecord := false\n\tresetArgs := false\n\tnewArgv := []string{}\n\tnewRedirects := [3]string{}\n\trestartPos := \"\"\n\n\tif len(v) > 0 {\n\t\tif v[0] == \"-r\" {\n\t\t\trerecord = true\n\t\t\tif len(v) == 2 {\n\t\t\t\tvar err error\n\t\t\t\tresetArgs, newArgv, newRedirects, err = parseNewArgv(v[1])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif len(v) > 1 {\n\t\t\t\treturn errors.New(\"too many arguments to restart\")\n\t\t\t}\n\t\t\trestartPos = v[0]\n\t\t}\n\t}\n\n\tif err := restartIntl(t, rerecord, restartPos, resetArgs, newArgv, newRedirects); err != nil {\n\t\treturn err\n\t}\n\n\tstate, err := t.client.GetState()\n\tif err != nil {\n\t\treturn err\n\t}\n\tprintcontext(t, state)\n\tprintPos(t, state.CurrentThread, printPosShowArrow)\n\tt.onStop()\n\treturn nil\n}","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L1197-L1233","documentation":"When restarting a recorded (RR) target, 'restart' accepts at most one positional argument: the checkpoint ID to restart from. restartRecorded returns this error when more than one positional argument is supplied. Extra arguments beyond the checkpoint ID are not meaningful for a recorded restart.","triggerScenarios":"Running 'restart c1 c2' or 'restart somearg extra' while debugging under rr recording: restart parses flags, then the else-branch sees len(v) > 1 positional args and returns the error (pkg/terminal/command.go:1215).","commonSituations":"Passing both a checkpoint ID and program arguments (program arguments require -noargs / new argv syntax instead); scripting restart with extra tokens; confusing recorded-mode restart with live-mode restart argument handling.","solutions":["Pass at most one checkpoint ID: 'restart <checkpoint-id>'","Use 'checkpoints' to list valid checkpoint IDs","To change program arguments use the new argv syntax (e.g. 'restart -noargs <args...>') rather than positional extras"],"exampleFix":"// before\nrestart c1 verbose\n// after\nrestart c1","handlingStrategy":"validation","validationCode":"if len(positionalArgs) > 1 {\n\treturn errors.New(\"restart accepts at most one checkpoint ID\")\n}","typeGuard":null,"tryCatchPattern":"if err := restart(...); strings.Contains(err.Error(), \"too many arguments to restart\") { /* drop extras and retry with single checkpoint id */ }","preventionTips":["Only pass a single checkpoint ID to recorded restart","Use -noargs/new-argv syntax for program arguments, not positional extras","Check 'help restart' before scripting"],"tags":["terminal","cli-usage","recorded-replay"],"backgroundTag":"too-many-arguments","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}