{"record":{"id":"3f2981f751a14587","repo":"apache/beam","slug":"process-does-not-exist-for-runner-v","errorCode":null,"errorMessage":"process does not exist for runner %v","messagePattern":"process does not exist for runner (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/process.go","lineNumber":120,"sourceCode":"func (e *ExpansionServiceRunner) StartService() error {\n\terr := e.serviceCommand.Start()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e.pingEndpoint(connectionTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// StopService stops the expansion service for a given ExpansionServiceRunner. Returns an error\n// if the command hasn't been run or if the process has already exited.\nfunc (e *ExpansionServiceRunner) StopService() error {\n\texpansionProcess := e.serviceCommand.Process\n\tif expansionProcess == nil {\n\t\treturn fmt.Errorf(\"process does not exist for runner %v\", e)\n\t}\n\tif e.serviceCommand.ProcessState != nil {\n\t\treturn fmt.Errorf(\"process has already completed, state: %v\", e)\n\t}\n\treturn expansionProcess.Kill()\n}\n","sourceCodeStart":102,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/process.go#L102-L127","documentation":"StopService kills the runner's expansion service process. If the underlying exec.Cmd was never started, cmd.Process is nil, and StopService returns \"process does not exist for runner %v\" instead of attempting a nil-pointer kill. It reflects calling Stop on a runner whose service was never launched.","triggerScenarios":"Calling runner.StopService() after constructing the runner with NewExpansionServiceRunner/NewPyExpansionServiceRunner but never calling StartService(), or after the command failed to spawn.","commonSituations":"Cleanup paths (deferred StopService) that run when StartService already failed; tests exercising Stop before Start; early-return error paths skipping Start.","solutions":["Only call StopService after a successful StartService; guard cleanup with a started flag.","Check the error from StartService before deferring StopService.","If using defer, make the deferred call tolerant of this error (log and continue)."],"exampleFix":"// before\nrunner.StartService()\ndefer runner.StopService()\n// after\nif err := runner.StartService(); err != nil {\n    return err\n}\ndefer func() {\n    if err := runner.StopService(); err != nil {\n        log.Printf(\"stop expansion service: %v\", err)\n    }\n}()","handlingStrategy":"try-catch","validationCode":"if !serviceStarted {\n    return errors.New(\"expansion service was never started; skip StopService\")\n}","typeGuard":null,"tryCatchPattern":"if err := runner.StopService(); err != nil {\n    log.Printf(\"stop expansion service (may be benign): %v\", err)\n}","preventionTips":["Only stop services you successfully started","Use a started flag around Start/Stop pairs","Keep cleanup idempotent"],"tags":["go","process-lifecycle","expansion-service"],"backgroundTag":"invalid-state-transition","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}