The API Reference for catalog:setActiveSources() fails to mention that it must be called from within a task. For example, if you pass an array of sources that includes an LrCollection, you get the error message "We can only wait from within a task" unless setActiveSources() is called from within a task.