Understanding Circular Dependencies and How to Fix Them

A dependency is when an item needs another item to function properly. For example, if your web map has a layer, that layer is a dependency for the web map. Circular Dependencies are when items appear to link back to themselves. They may do so directly, or through a chain of connected items. Either way, the item thinks it is a dependency of itself. Items with circular dependencies can cause issues when you try to use them.

A item that thinks its a dependency of itself creates an endless circular reference. Image Source.

How do Circular Dependencies happen?

An item cannot legitimately be a dependency of itself. This mis-mapping occurs when something has broken with the item. An invalid relationship may have formed, causing the item to link back to itself. It can also occur when the item’s data JSON has been edited and one of the item IDs for a dependency was replaced with the item ID for the main item itself.

How can a Circular Dependency be fixed?

You can fix a circular dependency by editing the item’s data JSON. The easiest way to do this is by using Admin Tools for ArcGIS. The screenshots here are from the Pro version, but the functionality is included in the Free version of Admin Tools as well. We’ll go through an example of how to fix this below.

To start, find the item with the circular dependency in the table. Click on the arrow button in the third column, and a menu will appear. You will want to select “View / Edit Item Data”.

An image of the 'Browse Items' page in Admin Tools for ArcGIS. A table is displayed with information about several items. The third column on each row features a button with a drop-down arrow. Upon clicking it, a menu appears with several options. In the screenshot, a gold rectangle highlights the 'View / Edit Item Data' option
Select the “View / Edit Item Data” option for the item with the circular dependency

A modal will appear with a text-editor in it. The Item Info JSON will be pre-populated in the text edit. To fix the circular dependency, you must first shift the view to Item Data JSON. This can be done with the select box above the text-editor.

A screenshot of the 'View / Edit Item Data' modal. Most of the screen is a text-editor with the Item Info Json. Above the text editor are various controls, including a select box for shifting the content displayed in the text editor. A gold box highlights this select box. Within the text editor, one of the properties displayed is the item's id. A gold bar underlines this property.
Note the web map’s id (underlined). We’ll see this again shortly.

Once the Item Data JSON has been selected, the text-editor will update its contents. You will need to check the item ids for each of the dependencies to see which one matches the item id of the web map. In this example case, the ‘itemId’ property for the “Starbucks” layer has been edited to match the item id of the web map. To fix the circular dependency, we simply need to replace the property with the Starbucks layer’s actual item id (retrieved from our ArcGIS Organization). After editing the property, click the ‘Save’ button above the text-editor to apply the changes.

A screenshot of the 'View / Edit Item Data' modal with the 'Item Data JSON' displayed. The 1st property is an array of operational layers for the web map. The layer titled 'Starbucks' has an itemId property underlined with a gold bar. The value for the itemId is the same as the item id property for the web map. This is what is causing the error, as the web map thinks it is its own layer. Among the various controls above the text editor, a button with a 'save' icon is highlighted with a gold box.
The layer’s ‘itemId’ property can’t be the same as the web map’s.

After the edits are successfully applied, the modal will display a success message. The item will have been updated in your ArcGIS Organization. If you do not immediately see the changes, you may need to clear your browser cache and refresh the web page to see the updates.

Note: If you are referencing the item in another product that caches your ArcGIS Organization, such as Backup My Organization or Clean My Organization, you will need to refresh your cache for the software to reflect the updates in your ArcGIS Org.

Did you find this article helpful? Would you like more helpful tricks, interesting guides, and other weekly updates from GEO Jobe? Then, subscribe to our blog or check out these recent articles:

Photo of Courtney Menikheim. They are about 5 foot 7, have hair cropped close to their head, except for the top, which hangs over by their jawline. They are smiling at the camera. They wear glasses.

Application Developer

Courtney is an enthusiastic GEODev and member of our Products team. When they aren't helping design and build software, Courtney enjoys playing board games, spending time with their dogs, and gardening.