"Invalid resident library" refers to the 3.1 ROMs failing to be patched in memory by the Setpatch
OS 3.9 Setpatch command in the s:startup-sequence loads the "Devs:AmigaOS ROM update" - if it does it correctly, then the resident libraries are available for use by applications.