OPatch Update Job Fails When Duplicate Directories Are Found in the Software Library

Issue

OPatch Update job fails with the following error:
2021-11-28 10:31:19,127 RemoteJobWorker 20236 ERROR em.jobs startDownload.772- OpatchUpdateLatest: java.lang.NullPointerException: Category, 'Oracle Software Updates', has no child named, 'OPatch' at oracle.sysman.emInternalSDK.core.patch.util. ComponentUtil.getComponentCategory (ComponentUtil.java:854)
After applying the January 2012 Enterprise Manager patch you see the following error:
Category, 'Oracle Software Updates' already exists.

Cause

The error occurs when two Patch Components directories are found in the Software Library. When you run two patch upload or download jobs (example: an OPatch patch download job and a regular patch download job) a race condition is created,which in turn creates two directories with the name Patch Components. The Software Library does not display an error while creating these duplicate directories. But when you run the OPatch Update job it fails with a NullPointerException.

Solution

If you see two Patch Components directories in the Software Library, delete the one with fewer entries and retry the failed patch job. To access the Software Library, from the Enterprise menu, select Provisioning and Patching, and click Software Library.

If you see only one Patch Components directory, but see the error Oracle Software Updates already exists. Retry the failed patch upload or download.