Can't Start WebDriverAgent on iOS

Hi all,

I’ve been using Appium to write some Xamarin.iOS tests, and I keep running into server errors. For several minutes, I get log input that the connection on port 8100 (the default) is refused, then eventually I get a 500 error with the message “Could not proxy command to the remote server.” From what I’ve found, there’s something going on with the WebDriverAgent failing to start, but I’m not sure whether this is something that I need to fix in Appium preferences, in the setup of my capabilities, or elsewhere on my Mac.

Here’s the end of the logs (it’s considerably longer than this):

[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[WebDriverAgent]e[39m Unable to connect to running WebDriverAgent: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[warn] e[35m[WebDriverAgent]e[39m Getting status of WebDriverAgent on device timed out. Continuing
[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975850637 (21:37:30 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975851649 (21:37:31 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975852660 (21:37:32 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975853665 (21:37:33 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975854674 (21:37:34 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975855680 (21:37:35 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975856688 (21:37:36 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975857695 (21:37:37 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975858700 (21:37:38 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975859711 (21:37:39 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975860715 (21:37:40 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975861721 (21:37:41 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975862728 (21:37:42 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975863733 (21:37:43 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...[debug] e[35m[BaseDriver]e[39m Event 'wdaSessionAttempted' logged at 1604975864743 (21:37:44 GMT-0500 (Eastern Standard Time))
[debug] e[35m[XCUITest]e[39m Sending createSession command to WDA
[debug] e[35m[WD Proxy]e[39m Matched '/status' to command name 'getStatus'
[debug] e[35m[WD Proxy]e[39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[info] e[35m[WD Proxy]e[39m connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...
[debug] e[35m[XCUITest]e[39m UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[XCUITest]e[39m     at JWProxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:275:13)
[debug] e[35m[XCUITest]e[39m     at processTicksAndRejections (internal/process/task_queues.js:85:5)
[debug] e[35m[XCUITest]e[39m Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[warn] e[35m[XCUITest]e[39m Quitting and uninstalling WebDriverAgent
[info] e[35m[WebDriverAgent]e[39m Shutting down sub-processes
[info] e[35m[WebDriverAgent]e[39m Shutting down 'xcodebuild' process (pid '5508')
[info] e[35m[WebDriverAgent]e[39m Sending 'SIGTERM'...
[error] e[35m[WebDriverAgent]e[39m xcodebuild exited with code 'null' and signal 'SIGTERM'
[debug] e[35m[iOSSim]e[39m Building bundle path map
[debug] e[35m[iOSSim]e[39m The simulator has '0' bundles which have 'WebDriverAgentRunner-Runner' as their 'CFBundleName':
[debug] e[35m[WebDriverAgent]e[39m No WDAs on the device.
[error] e[35m[XCUITest]e[39m {}
[info] e[35m[DevCon Factory]e[39m Releasing connections for E89E7253-4E90-4CBE-82F7-0B42188124B9 device on any port number
[info] e[35m[DevCon Factory]e[39m Found cached connections to release: ["E89E7253-4E90-4CBE-82F7-0B42188124B9:8100"]
[debug] e[35m[DevCon Factory]e[39m Cached connections count: 0
[debug] e[35m[XCUITest]e[39m Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] e[35m[IOSSimulatorLog]e[39m Stopping iOS log capture
[debug] e[35m[BaseDriver]e[39m Event 'newSessionStarted' logged at 1604975864843 (21:37:44 GMT-0500 (Eastern Standard Time))
[debug] e[35m[W3C]e[39m Encountered internal error running command: Error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[debug] e[35m[W3C]e[39m     at quitAndUninstall (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:532:15)
[debug] e[35m[W3C]e[39m     at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:593:11
[debug] e[35m[W3C]e[39m     at wrapped (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:35:13)
[debug] e[35m[W3C]e[39m     at retry (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:18:13)
[debug] e[35m[W3C]e[39m     at retryInterval (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:45:10)
[debug] e[35m[W3C]e[39m     at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:542:7
[debug] e[35m[W3C]e[39m Destroying socket connection
[info] e[35m[HTTP]e[39m e[37m<-- POST /wd/hub/session e[39me[31m500e[39m e[90m304594 ms - 1065e[39m
[info] e[35m[HTTP]e[39m e[90me[39m

Can anyone offer direction on what to debug for this? Thanks!

Did sort this out @stefanhk?