{"record":{"id":"b03e473d44b8bad4","repo":"wavetermdev/waveterm","slug":"command-is-required","errorCode":null,"errorMessage":"command is required","messagePattern":"command is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/jobcontroller/jobcontroller.go","lineNumber":621,"sourceCode":"type StartJobParams struct {\n\tConnName string\n\tJobKind  string\n\tCmd      string\n\tArgs     []string\n\tEnv      map[string]string\n\tTermSize *waveobj.TermSize\n\tBlockId  string\n}\n\nfunc StartJob(ctx context.Context, params StartJobParams) (string, error) {\n\tif params.ConnName == \"\" {\n\t\treturn \"\", fmt.Errorf(\"connection name is required\")\n\t}\n\tif params.JobKind != JobKind_Shell && params.JobKind != JobKind_Task {\n\t\treturn \"\", fmt.Errorf(\"jobkind must be %q or %q\", JobKind_Shell, JobKind_Task)\n\t}\n\tif params.Cmd == \"\" {\n\t\treturn \"\", fmt.Errorf(\"command is required\")\n\t}\n\tif params.TermSize == nil {\n\t\tparams.TermSize = &waveobj.TermSize{Rows: 24, Cols: 80}\n\t}\n\n\tisConnected, err := conncontroller.IsConnected(params.ConnName)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error checking connection status: %w\", err)\n\t}\n\tif !isConnected {\n\t\treturn \"\", fmt.Errorf(\"connection %q is not connected\", params.ConnName)\n\t}\n\n\tjobId := uuid.New().String()\n\tjobAuthToken, err := utilfn.RandomHexString(32)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate job auth token: %w\", err)\n\t}","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/jobcontroller/jobcontroller.go#L603-L639","documentation":"StartJob requires a non-empty Cmd in StartJobParams; an empty command has nothing to execute on the remote connection, so the call is rejected up front. It is a plain argument-validation failure thrown before any connection or database work.","triggerScenarios":"Calling StartJob (or StartRemoteShellJob / JobControllerStartJobCommand) with StartJobParams.Cmd == \"\" — e.g. a shell job created without a command string, or a task whose command was never populated from config/UI.","commonSituations":"Frontend submits a block with an empty command line, config file has a blank cmd field, a variable interpolation in the command string resolved to empty string.","solutions":["Provide the command to run in params.Cmd (e.g. \"bash -l\" for a shell job or the actual task command).","Trim and check the command string at the call site before invoking StartJob.","If the command is user-supplied, surface a validation message in the UI instead of letting the RPC fail."],"exampleFix":"// before\np.Cmd = cfg.Cmd // may be \"\"\n// after\nif strings.TrimSpace(cfg.Cmd) == \"\" { return errors.New(\"cmd must not be empty\") }\np.Cmd = cfg.Cmd","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(params.Cmd) == \"\" {\n    return errors.New(\"StartJobParams.Cmd must not be empty\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default Cmd to a known shell (e.g. \"bash -l\") when the caller has no explicit command.","Trim and validate command strings sourced from UI inputs or config files.","Fail fast in your own constructor for StartJobParams when Cmd is blank."],"tags":["validation","argument-error","jobcontroller"],"backgroundTag":"missing-required-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}