In Tanzu Platform for Cloud Foundry, when trying to create a Scheduler job in the Apps Manager UI, this error was shown:
Error creating job: Validation of resource failed. Name must be unique within a space.
Even though the name of the job that is being tried to be created was not found in the list of jobs, both in the Apps Manager UI or from the output of `cf jobs` command, the error persist.
When checked in the database, the particular job is existing in the "jobs" table and a related record (by job "guid") is also existing in the "scheduleables" table.
VMware Tanzu Platform For Cloud Foundry
VMware Tanzu Application Service
Run the following command to remove the orphaned job.
cf delete-job $JOB-NAME
This should delete the job from the scheduler's database tables. Once the above command completes successfully, then the job creation can be retried.