title: Could not proxy command to remote server. Original error: Error: read ECONNRESET
body: <p>I am not able to run the automation script that was running earlier. When i try to run the same code in new device its works fine.</p>
  
  <p><strong>Appium Server Log</strong></p>
  
  <blockquote>
    <p>[UiAutomator2] Running command: 'adb -s K3V4C18B16002502 shell am
    instrument -w
    io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner'
    [UiAutomator2] Waiting up to 20000ms for UiAutomator2 to be online...
    [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [UiAutomator2] [UIAutomator2] android.util.AndroidException:
    INSTRUMENTATION_FAILED:
    io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner
    [debug] [UiAutomator2] [UIAutomator2] INSTRUMENTATION_STATUS:
    Error=Unable to find instrumentation info for:
    ComponentInfo{io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner}
    [debug] [UiAutomator2] [UIAutomator2] INSTRUMENTATION_STATUS:
    id=ActivityManagerService [debug] [UiAutomator2] [UIAutomator2]
    INSTRUMENTATION_STATUS_CODE: -1 [debug] [UiAutomator2] [UIAutomator2]
      at com.android.commands.am.Instrument.run(Instrument.java:486)
    [debug] [UiAutomator2] [UIAutomator2]     at
    com.android.commands.am.Am.runInstrument(Am.java:194) [debug]
    [UiAutomator2] [UIAutomator2]     at
    com.android.commands.am.Am.onRun(Am.java:80) [debug] [UiAutomator2]
    [UIAutomator2]    at
    com.android.internal.os.BaseCommand.run(BaseCommand.java:54) [debug]
    [UiAutomator2] [UIAutomator2]     at
    com.android.commands.am.Am.main(Am.java:50) [debug] [UiAutomator2]
    [UIAutomator2]    at
    com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    [debug] [UiAutomator2] [UIAutomator2]     at
    com.android.internal.os.RuntimeInit.main(RuntimeInit.java:371) [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [JSONWP Proxy] Matched '/status' to command name 'getStatus' [debug]
    [JSONWP Proxy] Proxying [GET /status] to [GET
    <a href="http://localhost:8200/wd/hub/status]" rel="noreferrer">http://localhost:8200/wd/hub/status]</a> with no body [JSONWP Proxy] Got
    an unexpected response:
    {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"} [debug]
    [UiAutomator2] Deleting UiAutomator2 session [debug] [UiAutomator2]
    Deleting UiAutomator2 server session [debug] [JSONWP Proxy] Matched
    '/' to command name 'deleteSession' [UiAutomator2] Did not get
    confirmation UiAutomator2 deleteSession worked; Error was:
    UnknownError: An unknown server-side error occurred while processing
    the command. Original error: Trying to proxy a session command without
    session id [debug] [UiAutomator2] Resetting IME to
    'com.touchtype.swiftkey/com.touchtype.KeyboardService' [debug] [ADB]
    Running '/Users/infotmt/Library/Android/sdk/platform-tools/adb -P 5037
    -s K3V4C18B16002402 shell ime set com.touchtype.swiftkey/com.touchtype.KeyboardService' [debug] [ADB]
    Running '/Users/infotmt/Library/Android/sdk/platform-tools/adb -P 5037
    -s K3V4C18B16002402 shell am force-stop eu.niko.smart.naswi.personalization' [debug] [Logcat] Stopping logcat
    capture [debug] [ADB] Removing forwarded port socket connection: 8200 
    [debug] [ADB] Running
    '/Users/infotmt/Library/Android/sdk/platform-tools/adb -P 5037 -s
    K3V4C18B16002402 forward --remove tcp:8200' [debug] [ADB] Device API
    level: 28 [UiAutomator2] Restoring hidden api policy to the device
    default configuration [debug] [ADB] Running
    '/Users/infotmt/Library/Android/sdk/platform-tools/adb -P 5037 -s
    K3V4C18B16002402 shell settings delete global
    hidden_api_policy_pre_p_apps' [debug] [ADB] Running
    '/Users/infotmt/Library/Android/sdk/platform-tools/adb -P 5037 -s
    K3V4C18B16002402 shell settings delete global
    hidden_api_policy_p_apps' [debug] [BaseDriver] Event
    'newSessionStarted' logged at 1549963457849 (15:09:17 GMT+0545 (Nepal
    Time)) [debug] [W3C] Encountered internal error running command:
    UnknownError: An unknown server-side error occurred while processing
    the command. Original error: Could not proxy command to remote server.
    Original error: Error: read ECONNRESET [debug] [W3C]     at
    JWProxy.command
    (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:236:13)
    [HTTP] &lt;-- POST /wd/hub/session 500 50913 ms - 532</p>
  </blockquote>
  
  <p><strong>Java error log</strong></p>
  
  <blockquote>
    <p>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: Could not proxy command to remote server.
    Original error: Error: read ECONNRESET Build info: version:
    '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System
    info: host: 'Suban12.local', ip: 'fe80:0:0:0:486:de1:7ae1:b02d%en0',
    os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3',
    java.version: '1.8.0_202' Driver info: driver.version: AndroidDriver
    remote stacktrace: UnknownError: An unknown server-side error occurred
    while processing the command. Original error: Could not proxy command
    to remote server. Original error: Error: read ECONNRESET
        at JWProxy.command (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:236:13)
    Build info: version: '3.141.59', revision: 'e82be7d358', time:
    '2018-11-14T08:17:03' System info: host: 'Suban12.local', ip:
    'fe80:0:0:0:486:de1:7ae1:b02d%en0', os.name: 'Mac OS X', os.arch:
    'x86_64', os.version: '10.14.3', java.version: '1.8.0_202' Driver
    info: driver.version: AndroidDriver</p>
    
    <p>at
    io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
      at
    io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
      at
    io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
      at
    org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
      at
    io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
      at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
      at
    io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
      at
    org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
      at
    org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
      at
    io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
      at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
      at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)
      at
    io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:95)
      at util.AppiumHelper.setupPersDriver(AppiumHelper.java:74)  at
    test_cases.PersHelper.startPersAppReset(PersHelper.java:21)   at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)     at
    org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)   at
    org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)    at
    org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)   at
    org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      at
    org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
      at org.testng.TestRunner.privateRun(TestRunner.java:648)    at
    org.testng.TestRunner.run(TestRunner.java:505)    at
    org.testng.SuiteRunner.runTest(SuiteRunner.java:455)  at
    org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)  at
    org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)   at
    org.testng.SuiteRunner.run(SuiteRunner.java:364)  at
    org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)  at
    org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)   at
    org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)     at
    org.testng.TestNG.runSuitesLocally(TestNG.java:1137)  at
    org.testng.TestNG.runSuites(TestNG.java:1049)     at
    org.testng.TestNG.run(TestNG.java:1017)   at
    org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)     at
    org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
    Caused by: java.lang.reflect.InvocationTargetException    at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)     at
    io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
      ... 38 more Caused by: org.openqa.selenium.WebDriverException: An
    unknown server-side error occurred while processing the command.
    Original error: Could not proxy command to remote server. Original
    error: Error: read ECONNRESET Build info: version: '3.141.59',
    revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
    'Suban12.local', ip: 'fe80:0:0:0:486:de1:7ae1:b02d%en0', os.name: 'Mac
    OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version:
    '1.8.0_202' Driver info: driver.version: AndroidDriver remote
    stacktrace: UnknownError: An unknown server-side error occurred while
    processing the command. Original error: Could not proxy command to
    remote server. Original error: Error: read ECONNRESET
        at JWProxy.command (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:236:13)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)   at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at
    org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
      at
    org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
      at
    org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
      at
    java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      at
    java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
      at
    java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
      at
    java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
      at
    java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
      at
    java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at
    java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
      at
    java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at
    java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
      at
    org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
      ... 43 more</p>
  </blockquote>