# TypeError: Cannot read property 'documentID' of undefined

**URL:** <https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130>\
**Category:** UXP Plugin API\
**Created:** [January 9, 2022, 8:06pm UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130 "2022-01-09T20:06:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AAverin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/aaverin/32/1368_2.png) [@AAverin](https://forums.creativeclouddeveloper.com/u/AAverin)\
**Post date:** [January 9, 2022, 8:06pm UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/1 "2022-01-09T20:06:07Z")

</div>

Latest Photoshop 23.1.0 update started giving this strange error. Any idea what could be causing it and how to workaround? Happens on MacOS.

```auto
TypeError: Cannot read property 'documentID' of undefined
    at Photoshop.get

```

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [January 9, 2022, 10:44pm UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/2 "2022-01-09T22:44:39Z")

</div>

Where do you see this error? If it’s in Console, you should get a trace there

---

<div class="post-metadata">

**Author:** ![AAverin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/aaverin/32/1368_2.png) [@AAverin](https://forums.creativeclouddeveloper.com/u/AAverin)\
**Post date:** [January 10, 2022, 7:46am UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/3 "2022-01-10T07:46:06Z")

</div>

The error is coming from the customer, so logs are webpacked and compiled, stacktrace is not helpful.

```auto
TypeError: Cannot read property 'documentID' of undefined
    at Photoshop.get (uxp://uxp-internal:1:172216)
    at Root (webpack-internal:///./src/index.jsx:51:15)
    at renderWithHooks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:14803:18)
    at updateFunctionComponent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:17034:20)
    at beginWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:18610:16)
    at e.exports.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:188:14)
    at uxp://uxp-internal/domjs_scripts.js:2:8784
    at Object.runWithNativeHandler (<anonymous>)
    at I (uxp://uxp-internal/domjs_scripts.js:2:8676)
    at uxp://uxp-internal/domjs_scripts.js:2:8168

```

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [January 10, 2022, 7:55am UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/4 "2022-01-10T07:55:37Z")

</div>

I would start figuring out what this part is

```auto
Root (webpack-internal:///./src/index.jsx:51:15)

```

Maybe you then can pinpoint the location on a not packed version

---

<div class="post-metadata">

**Author:** ![AAverin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/aaverin/32/1368_2.png) [@AAverin](https://forums.creativeclouddeveloper.com/u/AAverin)\
**Post date:** [January 10, 2022, 8:08am UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/5 "2022-01-10T08:08:08Z")

</div>

The only thing Photoshop object related I do in my index file is checking if there is any active document present calling `ps.app.activeDocument`

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [January 10, 2022, 8:15am UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/6 "2022-01-10T08:15:05Z")

</div>

How does this check look like and what do you do if there’s no doc?  
What’s on `index.jsx:51:15`

---

<div class="post-metadata">

**Author:** ![AAverin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/aaverin/32/1368_2.png) [@AAverin](https://forums.creativeclouddeveloper.com/u/AAverin)\
**Post date:** [January 10, 2022, 8:48am UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/7 "2022-01-10T08:48:18Z")

</div>

I think I managed to reproduce the problem in development mode, will keep digging.

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [January 13, 2022, 6:46pm UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/8 "2022-01-13T18:46:33Z")

</div>

Looks like it was a bug. I see in pre-release v23.2 it has a bugfix logged as:

> UXP executeAsModal dialog cancellation =\> Cannot read property ‘documentID’ of undefined

Might be related. Do you get this error while canceling a modal?

---

<div class="post-metadata">

**Author:** ![AAverin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/aaverin/32/1368_2.png) [@AAverin](https://forums.creativeclouddeveloper.com/u/AAverin)\
**Post date:** [January 13, 2022, 9:14pm UTC](https://forums.creativeclouddeveloper.com/t/typeerror-cannot-read-property-documentid-of-undefined/4130/9 "2022-01-13T21:14:46Z")

</div>

Most likely. Issue was when canceling modal dialog of color picker.
