Skip to main content
Known Participant
December 10, 2025
Question

The layers and layerSets arrays sometimes do not contain certain groups

  • December 10, 2025
  • 3 replies
  • 296 views

I was assuming that the layers array always contains all art layers and all layer sets (groups) we see in photoshop. Similarly, layerSets contains all layer sets.

 

However, I found a case where this does not occur. More specifically, some groups are not included in the layers and layerSets arrays. I know this because I'm iterating through layer.layers or layer.layerSets in a for loop and these groups never show up.

 

When I make these problematic groups visible in photoshop or I select them, I don't see the usual bounding box we see for other layers/groups, which I think shows up when there are visible pixels. I suspect this is related to the issue.

 

At the same time, in my script, at some point, I also try to remove these groups and they actually show up and they are removed. So, maybe the order of the operations or something else is also affecting this.

 

Just to be clear, I see the groups and their layers in photoshop.

 

Do you know what could actually be causing some groups not to be included in layers or layerSets?

 

I'm using an ExtendScript script.

 

Photoshop version: 26.9.0

Scripting version: 26.9

3 replies

Legend
December 12, 2025

Upload a sample PSD file and your script so we can take a look.

c.pfaffenbichler
Community Expert
Community Expert
December 12, 2025

Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible and explain what shoudl happen vs. what does happen? 

Can you post the (relevant part of the) Script? 

dev102Author
Known Participant
December 30, 2025

What do the panels in photoshop have to do with this? I launch photoshop and then execute the script. I don't change anything in photoshop.

 

I cannot post the script, but I'm really just doing a normal index-based for loop through layer.layers or layer.layerSets, like I said. I am quite sure this has nothing to do with the for loop because this problem only occurs when the layers have no bounding box, but I actually don't even know why these layers have no bounding box and when in general the bounding boxes appear. It would be helpful if someone started by sharing their knowledge of this topic, if they know anything.

 

I also cannot share the original PSD file, because it's proprietary and private. Moreover, if I try to create a sample PSD, the problem may well go away. I was hoping for someone to share their actual knowledge of bounding boxes and why certain layers have no bounding boxes and how to actually create one layer without a bounding box. 

Legend
December 30, 2025

Without seeing your script there is no way we can test or offer answers. Same with your PSD file. We cannot help you without information.

dev102Author
Known Participant
December 10, 2025

(Existing answer that I was answering with this one was removed for some reason and I can't remove this one)

 

Can you point me to other conversations or the documentation that mention this then? I'd like to have some proof or evidence on what you're suggesting.

 

Moreover, what do you mean by refreshing specifically? Which function(s) should I call? I'd like to prevent or at least detect this behaviour and not expectedly end up with a different number of groups.