Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

illegal argument - argument 2 - internal error

New Here ,
Mar 30, 2025 Mar 30, 2025

I run a script to check smart object on my Photoshop. 

 

 
var doc = app.activeDocument;
 
function checkSmartObjectType(layer) {
    if (layer.kind == LayerKind.SMARTOBJECT) {
        try {
            var ref = new ActionReference();
            ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
            var desc = executeAction(charIDToTypeID("getd"), ref, DialogModes.NO);
            var smartObjDesc = desc.getObjectValue(stringIDToTypeID("smartObject"));
 
           
            if (!smartObjDesc.hasKey(stringIDToTypeID("link")) || smartObjDesc.getPath(stringIDToTypeID("link")) == null) {
                alert("Layer '" + layer.name + "' is Embedded Smart Object.");
                return;
            }
 
            if (smartObjDesc.hasKey(stringIDToTypeID("link"))) {
                var linkPath = smartObjDesc.getPath(stringIDToTypeID("link"));
                alert("Layer '" + layer.name + "' is Linked Smart Object.\nFile linked: " + linkPath);
                return;
            }
 
            alert("Layer '" + layer.name + "' is unusual.");
        } catch (e) {
            alert("Error '" + layer.name + "': " + e.message);
        }
    }
}
 
function processLayers(layers) {
    for (var i = 0; i < layers.length; i++) {
        var currentLayer = layers[i];
        checkSmartObjectType(currentLayer);
        
        if (currentLayer.typename == "LayerSet") {
            processLayers(currentLayer.layers);
        }
    }
}
 
if (doc.layers.length > 0) {
    processLayers(doc.layers);
} else {
    alert("No layer!");
}
I create Layer 1 and convert to smart object. Run script and i got error:
 jean_0376_0-1743349129405.png

 

My photoshop version

jean_0376_1-1743349214572.png

 

I think it was a bug.

 

TOPICS
Windows
163
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Mar 30, 2025 Mar 30, 2025

Hi @jean_0376 ,

 

Thank you for reporting this problem. What version of Windows OS are you using? Did this issue just start happening or have you installed an update recently?

Michelle

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 30, 2025 Mar 30, 2025
LATEST

Please use the </> button to enter code, just in case it breaks as regular text.

 

You can compare working code here:

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines