Hi @urbanstarship I've can reproduce the issue on my system here. Not sure if it is a bug, per se, but it is certainly not helpful behaviour.
In this case I would be inclined—rather than lodge a bug report—to put in a check in your code for an empty artboard before exporting. Here is a script that exports every artboard in the document, but only after checking if it's empty or not. The check is a bit of a hack, and destroys the current selection.
- Mark
/**
* @file Export Every Artboard As PSD.js
*
* Example of checking whether an artboard
* is empty before exporting.
*
* @author m1b
* @version 2025-05-28
* @discussion https://community.adobe.com/t5/illustrator-discussions/exportfile-broken-when-upgrading-to-illustrator-2025/m-p/15344164
*/
(function () {
var doc = app.activeDocument;
if (!doc.fullName.exists)
return alert('Please save this document first.');
for (var i = 0; i < doc.artboards.length; i++)
exportArtboardAsPSD(doc, i);
})();
function exportArtboardAsPSD(doc, index) {
if (index < 0 || index > doc.artboards.length)
throw new Error('exportArtboardAsPSD: bad `index` supplied.');
// check if there's artwork on this artboard
doc.selection = [];
doc.artboards.setActiveArtboardIndex(index);
app.executeMenuCommand('selectallinartboard');
if (0 === doc.selection.length)
// nothing on this artboard
return;
else
doc.selection = [];
var exportOptions = new ExportOptionsPhotoshop();
// export artboard 1
doc.artboards.setActiveArtboardIndex(index);
exportOptions.artboardRange = index+1;
exportOptions.antiAliasing = true;
exportOptions.artBoardClipping = true;
exportOptions.editableText = true;
exportOptions.imageColorSpace = ImageColorSpace.CMYK;
exportOptions.maximumEditability = true;
exportOptions.resolution = 72;
exportOptions.saveMultipleArtboards = true;
exportOptions.warnings = false;
exportOptions.writeLayers = true;
var file = File(doc.fullName.parent + '/test_' + doc.artboards[index].name + '.psd');
doc.exportFile(file, ExportType.PHOTOSHOP, exportOptions);
// reveal the exported file
// file.parent.execute();
};