Creating Action Object Inside Locked Project

In most cases, I create an Action object inside my functions, and then send those objects to a separate function that executes them:

function executeAction(project, action) {
  try {
    project.lockedAccess(() => {
      project.executeTransaction((compoundAction) => {    
        compoundAction.addAction(action);
      });
    });
  } catch (err) {
    console.log(`Error: ${err}`);
  }
}

However, I’ve come across some Keyframe removing actions (createRemoveKeyframeAction) that always fail in my functions. According to the forum post below, there are some action objects that can only be created after locking the project:

Indeed, createRemoveKeyframeAction works inside of project.lockedAccess.

Is there any way to tell which action objects have to be created inside of a locked project?

Thanks,
Ted