---
title: "[Contentstack Command-line Interface (CLI)] - Update Missing Reference UIDs for Entries, Assets, and Extensions"
description: Update missing reference UIDs for entries, assets, and extensions after importing data via Contentstack CLI.
url: https://www.contentstack.com/docs/developers/cli/update-missing-reference-uids
product: Contentstack
doc_type: how-to
audience:
  - developers
version: "CLI 1.17.4+"
last_updated: 2026-03-26
---

# [Contentstack Command-line Interface (CLI)] - Update Missing Reference UIDs for Entries, Assets, and Extensions

This page explains how to update missing reference UIDs for entries, assets, and extensions after importing data using Contentstack’s CLI. It is intended for developers using the CLI import and migration tooling, and should be used when imported entries do not display correctly due to unresolved references in the destination stack.

## Update Missing Reference UIDs for Entries, Assets, and Extensions

When importing data via Contentstack's CLI, if some of the reference UIDs of [assets](/docs/content-managers/author-content/about-assets), [entries](/docs/content-managers/author-content/about-entries), or [extensions](/docs/developers/experience-extensions-overview) in the destination stack are not updated within the entries. This can result in those entries not displaying correctly, potentially affecting functionalities that depend on them.

To resolve this, you can use the script `05-Update-reference-entry-from-mapper` to update the references. This script can be used under the following conditions:
- The referenced entries, assets, and extensions have already been created in the stack.
- The unique identifiers (UIDs) of the referenced items have not been updated in the referring entries.

This step-by-step guide lets you update the missing reference UIDs of entries, assets, and extensions in CLI.

## Prerequisites
- [Contentstack account](https://www.contentstack.com/login)
- [CLI installed](/docs/developers/cli/install-the-cli/) and [configured](/docs/developers/cli/configure-regions-in-the-cli/) (version 1.17.4 and above)
- [CLI authenticated](/docs/developers/cli/cli-authentication/)

## Steps for Execution
Follow the steps below to update the missing reference UIDs:
- [Import the data](/docs/developers/cli/import-content-using-the-cli) from the source stack using the `cm:stacks:import` command.
- Download the [examples](https://github.com/contentstack/cli/tree/main/packages/contentstack-migration/examples) folder and navigate to the folder using the `cd` command in the terminal.
```
cd
```
- Create a `config.json` file containing the following key-value pairs:**mapper-path**: The path to the backup directory where the logs are stored.
You can find the following path after a successful import operation in your CLI:
`<path>/_backup_<number>/logs/import`
Copy and use `<path>/_backup_<number>` in the config file.
- **contentTypes**: An array of content type UIDs whose references need to be updated.

```
{
  "mapper-path": "/_backup_/",
  "contentTypes": [
    "ct1",
    "ct2", ....
  ]
}
```
- Find the `05-Update-reference-entry-from-mapper` script in the `examples` folder. Execute the script using the [Migration](/docs/developers/cli/migrate-your-content-using-the-cli-migration-command/) command as follows:
```
csdx cm:stacks:migration --file-path ./05-Update-reference-entry-from-mapper.js --config-file ./config.json -k
```

## Troubleshoot
If you are facing a **Migration Unsuccessful** or **Module cannot be found** error, please try one of the following troubleshooting methods:
- **Troubleshoot in your current terminal session**:**Windows (CMD)**:
```
FOR /F "usebackq tokens=*" %i IN (`npm root -g @contentstack/cli`) DO SET NODE_PATH=%i/@contentstack/cli/node_modules
```
- **Windows (PowerShell)**:
```
foreach ($i in $(npm root -g @contentstack/cli)) { $env:NODE_PATH = "$i/@contentstack/cli/node_modules" }
```
- **Mac/Unix**:
```
export NODE_PATH="$(npm root -g @contentstack/cli)/@contentstack/cli/node_modules"
```

## Common questions

### When should I use the `05-Update-reference-entry-from-mapper` script?
Use it after importing data via Contentstack's CLI when reference UIDs for assets, entries, or extensions in the destination stack are not updated within the entries.

### What does `mapper-path` point to in `config.json`?
It is the path to the backup directory where the logs are stored, and you can find it after a successful import operation in your CLI: `<path>/_backup_<number>/logs/import`.

### What should I include in the `contentTypes` array?
An array of content type UIDs whose references need to be updated.

### What can I do if I see “Migration Unsuccessful” or “Module cannot be found”?
Try setting `NODE_PATH` using the provided commands for your environment: Windows (CMD), Windows (PowerShell), or Mac/Unix.