UiAutomator2 Server cannot start because the local port is busy

I am getting below issue when i run parallel execution Katalon runtime engine in Jenkins randomly

ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to start app with application ID: ‘com.ifs.cloud.Service’ (Root cause: org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: UiAutomator2 Server cannot start because the local port #8230 is busy. Make sure the port you provide via ‘systemPort’ capability is not occupied. This situation might often be a result of an inaccurate sessions management, e.g. old automation sessions on the same device must always be closed before starting new ones.

[2022-02-25T08:49:05.133404] Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’

[2022-02-25T08:49:05.133405] System info: host: ‘.local’, ip: ‘’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.16’, java.version: ‘1.8.0_275’

[2022-02-25T08:49:05.133406] Driver info: driver.version: SwipeableAndroidDriver

[2022-02-25T08:49:05.133416] remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: UiAutomator2 Server cannot start because the local port #8230 is busy. Make sure the port you provide via ‘systemPort’ capability is not occupied. This situation might often be a result of an inaccurate sessions management, e.g. old automation sessions on the same device must always be closed before starting new ones.

[2022-02-25T08:49:05.133417] at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)

[2022-02-25T08:49:05.133418] at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)

[2022-02-25T08:49:05.133419] Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’

[2022-02-25T08:49:05.133456] System info: host: ‘.local’, ip: ‘’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.16’, java.version: ‘1.8.0_275’

[2022-02-25T08:49:05.133457] Driver info: driver.version: SwipeableAndroidDriver

[2022-02-25T08:49:05.133458] at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)

[2022-02-25T08:49:05.133458] at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)

[2022-02-25T08:49:05.133459] at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)

[2022-02-25T08:49:05.133460] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)

[2022-02-25T08:49:05.133461] at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)

[2022-02-25T08:49:05.133510] at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)

[2022-02-25T08:49:05.133512] at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)

[2022-02-25T08:49:05.133513] at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)

[2022-02-25T08:49:05.133513] at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)

[2022-02-25T08:49:05.133514] at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)

[2022-02-25T08:49:05.133515] at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)

[2022-02-25T08:49:05.133516] at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)

[2022-02-25T08:49:05.133517] at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:85)

[2022-02-25T08:49:05.133517] at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.(SwipeableAndroidDriver.java:24)

[2022-02-25T08:49:05.133532] at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:498)

[2022-02-25T08:49:05.133533] at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:480)

[2022-02-25T08:49:05.133534] at com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory.startMobileDriver(MobileDriverFactory.java:417)

[2022-02-25T08:49:05.133535] at com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory$startMobileDriver$0.call(Unknown Source)

[2022-02-25T08:49:05.133556] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword$_startApplication_closure1.doCall(StartExistingApplicationKeyword.groovy:40)

[2022-02-25T08:49:05.133558] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword$_startApplication_closure1.doCall(StartExistingApplicationKeyword.groovy)

[2022-02-25T08:49:05.133559] at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)

[2022-02-25T08:49:05.133559] at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain$runKeyword.call(Unknown Source)

[2022-02-25T08:49:05.133634] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword.startApplication(StartExistingApplicationKeyword.groovy:43)

[2022-02-25T08:49:05.133635] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword.execute(StartExistingApplicationKeyword.groovy:34)

[2022-02-25T08:49:05.133636] at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)

[2022-02-25T08:49:05.133637] at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.startExistingApplication(MobileBuiltInKeywords.groovy:112)

[2022-02-25T08:49:05.133638] at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$startExistingApplication.call(Unknown Source)

[2022-02-25T08:49:05.133639] at Activate device.run(Activate device:76)

[2022-02-25T08:49:05.133639] at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)

[2022-02-25T08:49:05.133640] at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)

[2022-02-25T08:49:05.133641] at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)

[2022-02-25T08:49:05.133642] at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)

[2022-02-25T08:49:05.133642] at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)

[2022-02-25T08:49:05.133643] at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)

[2022-02-25T08:49:05.133644] at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)

[2022-02-25T08:49:05.133645] at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:203)

[2022-02-25T08:49:05.133646] at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:152)

[2022-02-25T08:49:05.133754] at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:95)

[2022-02-25T08:49:05.133755] at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)

[2022-02-25T08:49:05.133756] at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)

[2022-02-25T08:49:05.133756] at TempTestSuite1645759070177.run(TempTestSuite1645759070177.groovy:39)

[2022-02-25T08:49:05.133757] Caused by: java.lang.reflect.InvocationTargetException

[2022-02-25T08:49:05.133758] at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)

[2022-02-25T08:49:05.133759] at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)

[2022-02-25T08:49:05.133760] at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)

[2022-02-25T08:49:05.133760] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)

[2022-02-25T08:49:05.133761] at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)

[2022-02-25T08:49:05.133762] at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)

[2022-02-25T08:49:05.133763] at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)

[2022-02-25T08:49:05.133764] at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)

[2022-02-25T08:49:05.133764] at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)

[2022-02-25T08:49:05.133765] at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)

[2022-02-25T08:49:05.133766] at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)

[2022-02-25T08:49:05.133767] at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)

[2022-02-25T08:49:05.133767] at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:85)

[2022-02-25T08:49:05.133768] at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.(SwipeableAndroidDriver.java:24)

[2022-02-25T08:49:05.133769] at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:498)

[2022-02-25T08:49:05.133770] at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:480)

[2022-02-25T08:49:05.133771] at com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory.startMobileDriver(MobileDriverFactory.java:417)

[2022-02-25T08:49:05.133771] at com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory$startMobileDriver$0.call(Unknown Source)

[2022-02-25T08:49:05.133777] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword$_startApplication_closure1.doCall(StartExistingApplicationKeyword.groovy:40)

[2022-02-25T08:49:05.133778] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword$_startApplication_closure1.doCall(StartExistingApplicationKeyword.groovy)

[2022-02-25T08:49:05.133779] at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)

[2022-02-25T08:49:05.133815] at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain$runKeyword.call(Unknown Source)

[2022-02-25T08:49:05.133816] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword.startApplication(StartExistingApplicationKeyword.groovy:43)

[2022-02-25T08:49:05.133817] at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword.execute(StartExistingApplicationKeyword.groovy:34)

[2022-02-25T08:49:05.133819] at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)

[2022-02-25T08:49:05.133820] at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.startExistingApplication(MobileBuiltInKeywords.groovy:112)

[2022-02-25T08:49:05.133821] at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$startExistingApplication.call(Unknown Source)

[2022-02-25T08:49:05.133831] at Script1568287787823.run(Script1568287787823.groovy:76)

[2022-02-25T08:49:05.133832] … 13 more

I think the issue is that you run automation tests on the same device at the same time that is not recommended.
Please try to:

  • Terminate all the current Appium processes: node.exe and adb.exe
  • Run again but on the different device at the same time.

Thank you for replying quickly, This is mobile project where we are running our test suites in 2 android devices. If I explain little bit more we are running Katalon test suits using Jenkins pipeline using KRE in a MaC. Jenkins pipeline will run 2 KRE instances same time and 2 android devices connected to MAC will be used for executing test suits.

This is random issue it is not visible when we run test suites using Katalon studio.

is there way to Terminate current Appium processes after completing test suite from katalon .?