Hi Stephen, thanks for your reply. This is the error that comes up when I execute the keyboard shortcut which I assigned to the script. 
Both blocks of code work for me in Ps2024 (25.9.1) without error and I am also on a Mac.
For what it's worth, here is the re-recorded code (tested in 25.9.1 and 25.11.0):
// Work Path to Selection
var idset = stringIDToTypeID( "set" );
var desc286 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref25 = new ActionReference();
var idchannel = stringIDToTypeID( "channel" );
var idselection = stringIDToTypeID( "selection" );
ref25.putProperty( idchannel, idselection );
desc286.putReference( idnull, ref25 );
var idto = stringIDToTypeID( "to" );
var ref26 = new ActionReference();
var idpath = stringIDToTypeID( "path" );
var idworkPath = stringIDToTypeID( "workPath" );
ref26.putProperty( idpath, idworkPath );
desc286.putReference( idto, ref26 );
var idversion = stringIDToTypeID( "version" );
desc286.putInteger( idversion, 1 );
var idvectorMaskParams = stringIDToTypeID( "vectorMaskParams" );
desc286.putBoolean( idvectorMaskParams, true );
executeAction( idset, desc286, DialogModes.NO );
Or:
// Work Path to Selection
var idset = stringIDToTypeID( "set" );
var desc301 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref29 = new ActionReference();
var idchannel = stringIDToTypeID( "channel" );
var idselection = stringIDToTypeID( "selection" );
ref29.putProperty( idchannel, idselection );
desc301.putReference( idnull, ref29 );
var idto = stringIDToTypeID( "to" );
var ref30 = new ActionReference();
var idpath = stringIDToTypeID( "path" );
var idworkPath = stringIDToTypeID( "workPath" );
ref30.putProperty( idpath, idworkPath );
desc301.putReference( idto, ref30 );
executeAction( idset, desc301, DialogModes.NO );
Or:
// Active path to selection
var idset = stringIDToTypeID( "set" );
var desc411 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref79 = new ActionReference();
var idchannel = stringIDToTypeID( "channel" );
var idselection = stringIDToTypeID( "selection" );
ref79.putProperty( idchannel, idselection );
desc411.putReference( idnull, ref79 );
var idto = stringIDToTypeID( "to" );
var ref80 = new ActionReference();
var idpath = stringIDToTypeID( "path" );
var idordinal = stringIDToTypeID( "ordinal" );
var idtargetEnum = stringIDToTypeID( "targetEnum" );
ref80.putEnumerated( idpath, idordinal, idtargetEnum );
desc411.putReference( idto, ref80 );
executeAction( idset, desc411, DialogModes.NO );