Nope, nevermind I thought it was entering a condition but no, the error comes from a suitelet that gets called right after that, on the suitelet there is the same error,
RCRD_LOCKED_BY_WF: This record has been locked by a user defined workflow.
and it has an
nlapiLoadRecord()