{"record":{"id":"c9922eeeee1c88da","repo":"wavetermdev/waveterm","slug":"must-provide-a-builderid-to-restartbuilderandwaitc","errorCode":null,"errorMessage":"must provide a builderId to RestartBuilderAndWaitCommand","messagePattern":"must provide a builderId to RestartBuilderAndWaitCommand","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshserver/wshserver.go","lineNumber":1166,"sourceCode":"\t\treturn fmt.Errorf(\"builder appid not set for builderid: %s\", data.BuilderId)\n\t}\n\treturn bc.Start(ctx, appId, rtInfo.BuilderEnv)\n}\n\nfunc (ws *WshServer) StopBuilderCommand(ctx context.Context, builderId string) error {\n\tif builderId == \"\" {\n\t\treturn fmt.Errorf(\"must provide a builderId to StopBuilderCommand\")\n\t}\n\tbc := buildercontroller.GetController(builderId)\n\tif bc == nil {\n\t\treturn nil\n\t}\n\treturn bc.Stop()\n}\n\nfunc (ws *WshServer) RestartBuilderAndWaitCommand(ctx context.Context, data wshrpc.CommandRestartBuilderAndWaitData) (*wshrpc.RestartBuilderAndWaitResult, error) {\n\tif data.BuilderId == \"\" {\n\t\treturn nil, fmt.Errorf(\"must provide a builderId to RestartBuilderAndWaitCommand\")\n\t}\n\n\tbc := buildercontroller.GetOrCreateController(data.BuilderId)\n\trtInfo := wstore.GetRTInfo(waveobj.MakeORef(\"builder\", data.BuilderId))\n\tif rtInfo == nil {\n\t\treturn nil, fmt.Errorf(\"builder rtinfo not found for builderid: %s\", data.BuilderId)\n\t}\n\n\tappId := rtInfo.BuilderAppId\n\tif appId == \"\" {\n\t\treturn nil, fmt.Errorf(\"builder appid not set for builderid: %s\", data.BuilderId)\n\t}\n\n\tresult, err := bc.RestartAndWaitForBuild(ctx, appId, rtInfo.BuilderEnv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":1148,"sourceCodeEnd":1184,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshserver/wshserver.go#L1148-L1184","documentation":"RestartBuilderAndWaitCommand restarts a builder and blocks until the build finishes; it needs data.BuilderId to identify the controller. The server returns this error when BuilderId is empty, before creating/looking up the controller.","triggerScenarios":"Invoking the RPC with CommandRestartBuilderAndWaitData.BuilderId == \"\" — the caller never populated it or derived it from an empty state object.","commonSituations":"Automation pipelines restarting builds after a deploy where the id variable was never assigned; UI restart buttons firing without a selected builder; serialization dropping the field in a custom client.","solutions":["Populate CommandRestartBuilderAndWaitData.BuilderId with the builder's OID before calling","Ensure the builder selection/loading completed before restarting","Add client-side empty-check validation before the RPC"],"exampleFix":"// before\nclient.RestartBuilderAndWaitCommand(ctx, wshrpc.CommandRestartBuilderAndWaitData{})\n// after\nclient.RestartBuilderAndWaitCommand(ctx, wshrpc.CommandRestartBuilderAndWaitData{BuilderId: builderId})","handlingStrategy":"validation","validationCode":"if data.BuilderId == \"\" {\n    return fmt.Errorf(\"cannot restart builder: BuilderId is empty\")\n}\nresult, err := client.RestartBuilderAndWaitCommand(ctx, data)","typeGuard":"func restartable(data wshrpc.CommandRestartBuilderAndWaitData) bool {\n    return data.BuilderId != \"\"\n}","tryCatchPattern":"result, err := client.RestartBuilderAndWaitCommand(ctx, data)\nif err != nil {\n    if strings.Contains(err.Error(), \"must provide a builderId\") {\n        // caller bug: set BuilderId and retry once\n    }\n    return nil, err\n}","preventionTips":["Populate the command struct from the selected builder object only","Check field completeness in CI scripts before invoking restarts","Serialize the full struct (ensure BuilderId isn't dropped by custom codecs)"],"tags":["rpc","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}