I've come across this a lot actually, after looking through the scriptEditor when I run into this I get the following output (and this is with using the UI to create a polygonal primitive, UI with option box and reset settings, UI with option box to mess with settings, the mel command with construction history on, and construction history off -save with the remark about history being on not showing up when setting the flag -ch 0)
CreatePolygonCylinder;
polyCylinder -r 1 -h 2 -sx 20 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1;
// Error: line 0: Connection not made: 'pCylinderShape1.instObjGroups[0]' -> 'initialShadingGroup.dagSetMembers[-1]'. Destination is locked.
// Error: line 0: Connection not made: 'pCylinderShape1.instObjGroups[0]' -> 'initialShadingGroup.dagSetMembers[-1]'. Destination is locked.
// Warning: line 0: You have an empty result since history is on. You may want to undo the last command.
isolateSelect -loadSelected modelEditor1;
// Result: pCylinder1 polyCylinder1
some how this bit got saved in a maya ascii file (opening said file will start the issue for the rest of the maya session, and spread to any other file saved after encountering it... it's like a maya virus):
select -ne :initialShadingGroup;
setAttr -av -k on ".cch";
setAttr -k on ".fzn";
setAttr -cb on ".ihi";
setAttr -av -k on ".nds";
setAttr -cb on ".bnm";
setAttr -k on ".bbx";
setAttr -k on ".vwm";
setAttr -k on ".tpv";
setAttr -k on ".uit";
setAttr -k on ".mwc";
setAttr -cb on ".an";
setAttr -cb on ".il";
setAttr -cb on ".vo";
setAttr -cb on ".eo";
setAttr -cb on ".fo";
setAttr -cb on ".epo";
setAttr -k on ".ro" yes;
lockNode -l 0 -lu 1;
The commands below fixes the issue (or one could remark out that lockNode line and the scene will work fine):
select -ne :initialShadingGroup; lockNode -l 0 -lu 0;
I don't know what you would call this behavior if you wouldn't call it a bug, but it's definitely not working as intended. And to throw the blame on the user... bad form.