The CreatorCon Call for Content is officially open! Get started here.

Error creating UI Component via ServiceNow CLI: "Scope is already taken" — seeking guidance for mark

henriquepel
Giga Contributor


Hello Community,

I'm trying to create a marketplace-ready app in ServiceNow using the UI Component via ServiceNow CLI, but I keep running into the following error. No matter which scope I choose, I get:

Failed to run project command (Table Operation CREATE Failure: Response code 400 (Bad Request) : This scope is already taken by another application)

I would like to know if anyone has experienced this and what the proper approach to resolve it would be.

 

 

App context and requirements:

Goal: Implement an AI Copilot widget in the Service Operations Workspace (SOW), specifically in the incident record sidebar.

Technical requirements:
- Integration: iframe + postMessage API for secure cross-origin communication between ServiceNow and an external multi-tenant application
- Deployment: ServiceNow Store / Marketplace as a scoped application
- UI Location: Incident Record Page sidebar (right panel) in SOW (Zurich release)
- Architecture: External multi-tenant application communicating with ServiceNow instances

Current implementation:
- Existing app/widget pointing to a multi-tenant app
- Server script extracting incident context (sys_id, number, description, state, priority, etc.)
- HTML template with responsive iframe container
- PostMessage communication partially implemented

 

 

Questions for the community:

1. Am I on the right path creating the app via snc ui-component for Marketplace deployment?
2. Has anyone encountered the "This scope is already taken by another application" error even when creating a new scope?
3. Are there any specific requirements for scopes or app records that could trigger this error in Zurich + UI Component CLI?
4. What is the best practice for managing scopes and creating marketplace-ready apps via CLI without using Studio?

Any guidance, documentation links, or tips would be greatly appreciated!

1 ACCEPTED SOLUTION

henriquepel
Giga Contributor

@mayankkumar 

We don't know exactly why this happens — it's something pretty odd. We know that we need a scope when creating apps, like we did before when we created an SDK App. What we didn't know at first is that we don't actually need an SDK app just to create and place a simple UI component inside the Service Operations Workspace (such as the incident/ticket page).

 

What we did to make the ui-component creation work was reuse the scope we had already created for the SDK app. Once we did that, the component creation worked without the "scope already taken" error.

 

UNDERSTANDING EACH CONCEPT (YOU CAN CORRECT ME IF WE IT'S WRONG)

 

SDK App (App Engine SDK)

 

A ServiceNow SDK App is a complete application built locally using the ServiceNow SDK. It can include data models, flows, business logic, and UI elements. Apps created this way can be versioned, deployed, and published to the ServiceNow Store.

 

Think of it as the entire application package.

 

  • It provides a full set of tools and libraries for building apps outside the instance (in our local environment).
  • It creates the base structure of an application (folders, manifests, pipelines, etc.) and prepares it for packaging, versioning, and deployment.
  • It lets us develop, test, and version apps before deploying them to our instance.
  • Initialize it with:

 

    npx @servicenow/sdk init

 

Summary: The SDK creates the complete app environment, where we can later add components, flows, tables, and more.

 

UI Component

 

A UI Component is a modern, reusable piece of UI built with the ServiceNow UI Framework (@servicenow/ui-core) using the ServiceNow CLI. These components can be placed directly into pages in the Next Experience or inside workspaces such as the Service Operations Workspace.

 

Important: UI components themselves are not published independently to the Store, but when they are packaged inside an SDK app, they can be distributed and published as part of that application.

 

Think of a UI component as a single building block of the user interface.

 

Example command to create one:

 

    snc ui-component project --name example-name8i12jhn1 --scope x_1810839_maven

 

Widget

 

A Widget is a legacy component type used in the Service Portal, built with AngularJS and server-side scripts. Widgets are still supported but not recommended for new projects — UI components are the modern replacement.

 

SERVICENOW SDK – THE APPLICATION DEVELOPMENT ECOSYSTEM

 

  • The SDK is a set of tools and libraries provided by ServiceNow to build applications outside the instance (in our local environment).
  • It creates the base structure of an app (folders, manifests, pipelines, etc.) and prepares it for packaging, versioning, and deployment.
  • It lets us develop, test, and version apps before deploying them.
  • Initialize a new SDK app with:

 

    npx @servicenow/sdk init

 

The SDK handles the macro level of our project — the entire application.

 

Summary: The SDK builds the complete app environment, inside which we can add components, flows, tables, and more.

 

SERVICENOW CLI (snc) – THE COMMAND-LINE TOOL

 

  • The CLI (snc) is the command-line tool that communicates with the SDK and the ServiceNow platform.
  • It's used to manage individual resources inside our app (e.g., create a UI component, deploy code, update versions, etc.).
  • We run commands like:

 

    snc ui-component project --name example-name8i12jhn1 --scope x_1810839_maven

    snc ui-component deploy

 

The CLI handles the micro level — working on parts of the app created by the SDK.

 

Summary: The CLI is the operational tool we use inside the environment created by the SDK.

 

RELATIONSHIP BETWEEN SDK AND CLI

 

  • The SDK creates and structures the entire app.
  • The CLI manages components and specific actions inside that app.

 

We can think of it like this:

 

  • SDK = building the whole building.
  • CLI = installing doors, windows, and electrical systems inside it.

 

IN OUR CASE

 

  • npx @servicenow/sdk init → created the base app with a scope.
  • snc ui-component project → created a UI component inside that app, reusing the existing scope.


SUMMARY

  • We don't need a full SDK app just to build and test a UI component.
  • We do need a valid scope, and reusing the one from an SDK app is a good solution when facing the "scope already taken" error.
  • If our goal is to publish the component to the ServiceNow Store, it must be packaged inside an SDK app.

View solution in original post

4 REPLIES 4

mayankkumar
Kilo Patron
Kilo Patron

Hi @henriquepel,
You can try Component Builder provided by ServiceNow OOB from Zurich Release
refer this -> Create custom components to reuse across pages with component builder
and if you still want to go with the CLI approach, you can refer this tutorial video -> Checklist Tutorial - ServiceNow Next UI Custom Component Development

other useful resources -> Creating Custom Components – ServicePortal.io
----------------------------------------------------------------------------------------------------------------------------------------------
Please mark my response helpful and accept as solution
Thanks & Regards
Mayank

 

Hi Mayank,

Thanks a lot for the pointers! I’ll definitely check out the Component Builder and the tutorial you shared.

However, I still feel the main issue wasn’t addressed. The error below keeps happening no matter which scope I try, and I couldn’t find a clear explanation for it.

Failed to run project command (Table Operation CREATE Failure: Response code 400 (Bad Request) : This scope is already taken by another application)


Im wondering if this could be related to the fact that my developer instance might not be registered as a vendor account, but I’m not entirely sure. Do you happen to know why this occurs or what the proper way to resolve it would be?

Also, just to confirm my understanding, as far as I know, the more flexible and marketplace-ready approach is indeed using the ServiceNow CLI to create a UI Component, since that allows proper code-level access and customization, correct? If there’s any official documentation on this approach, I’d really appreciate it if you could share it.

Thanks again!

Hi @henriquepel,
I had created a custom component earlier on my PDI. It was a bit challenging with the CLI approach, but I managed to get it working using the references I shared. I’ll need to do a small workaround again, and then I’ll update you about the issue.

henriquepel
Giga Contributor

@mayankkumar 

We don't know exactly why this happens — it's something pretty odd. We know that we need a scope when creating apps, like we did before when we created an SDK App. What we didn't know at first is that we don't actually need an SDK app just to create and place a simple UI component inside the Service Operations Workspace (such as the incident/ticket page).

 

What we did to make the ui-component creation work was reuse the scope we had already created for the SDK app. Once we did that, the component creation worked without the "scope already taken" error.

 

UNDERSTANDING EACH CONCEPT (YOU CAN CORRECT ME IF WE IT'S WRONG)

 

SDK App (App Engine SDK)

 

A ServiceNow SDK App is a complete application built locally using the ServiceNow SDK. It can include data models, flows, business logic, and UI elements. Apps created this way can be versioned, deployed, and published to the ServiceNow Store.

 

Think of it as the entire application package.

 

  • It provides a full set of tools and libraries for building apps outside the instance (in our local environment).
  • It creates the base structure of an application (folders, manifests, pipelines, etc.) and prepares it for packaging, versioning, and deployment.
  • It lets us develop, test, and version apps before deploying them to our instance.
  • Initialize it with:

 

    npx @servicenow/sdk init

 

Summary: The SDK creates the complete app environment, where we can later add components, flows, tables, and more.

 

UI Component

 

A UI Component is a modern, reusable piece of UI built with the ServiceNow UI Framework (@servicenow/ui-core) using the ServiceNow CLI. These components can be placed directly into pages in the Next Experience or inside workspaces such as the Service Operations Workspace.

 

Important: UI components themselves are not published independently to the Store, but when they are packaged inside an SDK app, they can be distributed and published as part of that application.

 

Think of a UI component as a single building block of the user interface.

 

Example command to create one:

 

    snc ui-component project --name example-name8i12jhn1 --scope x_1810839_maven

 

Widget

 

A Widget is a legacy component type used in the Service Portal, built with AngularJS and server-side scripts. Widgets are still supported but not recommended for new projects — UI components are the modern replacement.

 

SERVICENOW SDK – THE APPLICATION DEVELOPMENT ECOSYSTEM

 

  • The SDK is a set of tools and libraries provided by ServiceNow to build applications outside the instance (in our local environment).
  • It creates the base structure of an app (folders, manifests, pipelines, etc.) and prepares it for packaging, versioning, and deployment.
  • It lets us develop, test, and version apps before deploying them.
  • Initialize a new SDK app with:

 

    npx @servicenow/sdk init

 

The SDK handles the macro level of our project — the entire application.

 

Summary: The SDK builds the complete app environment, inside which we can add components, flows, tables, and more.

 

SERVICENOW CLI (snc) – THE COMMAND-LINE TOOL

 

  • The CLI (snc) is the command-line tool that communicates with the SDK and the ServiceNow platform.
  • It's used to manage individual resources inside our app (e.g., create a UI component, deploy code, update versions, etc.).
  • We run commands like:

 

    snc ui-component project --name example-name8i12jhn1 --scope x_1810839_maven

    snc ui-component deploy

 

The CLI handles the micro level — working on parts of the app created by the SDK.

 

Summary: The CLI is the operational tool we use inside the environment created by the SDK.

 

RELATIONSHIP BETWEEN SDK AND CLI

 

  • The SDK creates and structures the entire app.
  • The CLI manages components and specific actions inside that app.

 

We can think of it like this:

 

  • SDK = building the whole building.
  • CLI = installing doors, windows, and electrical systems inside it.

 

IN OUR CASE

 

  • npx @servicenow/sdk init → created the base app with a scope.
  • snc ui-component project → created a UI component inside that app, reusing the existing scope.


SUMMARY

  • We don't need a full SDK app just to build and test a UI component.
  • We do need a valid scope, and reusing the one from an SDK app is a good solution when facing the "scope already taken" error.
  • If our goal is to publish the component to the ServiceNow Store, it must be packaged inside an SDK app.