"Failed to listen on prefix 'http://127.0.0.1:10001/authorize/' because it conflicts with an existing registration on the machine"

How to resolve the "Failed to listen on prefix 'http://127.0.0.1:10001/authorize/'" error in the ServiceNow Application Scope activity during classic ServiceNow integration?

Use Case Description

Organizations may be interested in integrating ServiceNow into their automation workflows.
UiPath provides two integrations to enable two-way automation between UiPath and ServiceNow:

  1. The ServiceNow activity package (Classic Integration).
  2. UiPath connector for ServiceNow (Modern Integration).

In the ServiceNow activity package, to enable outbound automation between UiPath and ServiceNow, the activities establish an authenticated connection to the ServiceNow API via the ServiceNow Application Scope activity (mandatory).

Note: Consult with the ServiceNow Administrator and stakeholders to determine whether Basic or OAuth authentication is required. This information is needed in the ServiceNow Application Scope > Configure Wizard and the activity properties:

  • Basic Authentication: Requires the Endpoint URL, a User Name, and a Password.

  • Access Token (OAuth2): To retrieve the access token, it needs the Endpoint URL, Client ID, and Client Secret.

Issue Description

Different configuration scenarios are often tested while integrating ServiceNow using OAuth2 in UiPath, which may lead to one of the most common errors related to the current listening ports on the Studio machine.

System.Exception: One or more errors occurred. ---> System.Exception: Failed to listen on prefix 'http://127.0.0.1:10001/authorize/' because it conflicts with an existing registration on the machine.

Root Cause

The error indicates that another process on the local machine already uses the same IP address and port (127.0.0.1:10001), creating a conflict when connecting to ServiceNow via OAuth. This is what might be happening locally:

  • Port in use: Port 10001 is already occupied by a Studio, another process, or an application. (Only one process at a time can listen to a specific port on a machine.)
  • Local redirection conflict: When using OAuth, a local redirection URL is typically set to manage the authorization flow. If another service or instance of the same application is already configured to listen on that port, it can cause this conflict.

Resolution

Important Notes:

  1. This KB Article is related to the ServiceNow activity package, classic integration.
  2. The error/behavior this KB attempts to fix occurs when using the Access Token (OAuth2) authentication.

Possible solutions (try them in this order):

  1. If previous connection attempts were made from Studio, restart the UiPath Studio application and reopen the target process.
  2. Restart the UiPath Studio/Robot machine to ensure there is no previous Studio/ServiceNow information cached locally and reopen the UiPath Studio process.
  3. Change the target port in the ServiceNow Scope Activity to a different port.

Additional Verification and Information:

  1. Verify the ServiceNow Roles assigned to the target user and ensure it has at least one of the following roles:
    • Administrator [admin] (this includes all level access and can be used temporarily for troubleshooting purposes)
    • ITIL [it'll] (this includes the snc_platform_rest_api_access)
  2. Check the setup documentation and ensure the target application is properly configured: