NiFi throws "The specified observer identifier already exists" exception when trying to instantiate a template to the canvas. Parsing the template xml reveals multiple controller services with same UUID.
Steps to reproduce:
1. Create "PG-level1"
2. within "PG-level1" create two new sub process groups "PG-level2-A" and "PG-level2-B".
3. Create a controller service(s) in "PG-level2-A" like AvroReader and CSVRecordSetWriter. Add a processor like ConvertRecord and configure it to reference these two controller services.
4. Right click on the ConvertRecord processor and copy it. Exit "PG-level2-A" and enter "PG-level2-B" and paste that copy processor. The processor will show both configured controller services as "Incompatible Controller Service Configured" and invalid bulletin will reflect the properties reference controller services that do not exist.
5. go up to "PG-level1" level and generate a template. Template is created successfully.
6. Try to instantiate this template to the canvas and it will only partially instantiate and throw the "observer identifier already exist exception.
Inspection of the template shows that the controller services scoped to PG-level2-A were added into the template again at the parent "PG-level1" scope with same UUID.
The expected behavior is that the controller services do not get duplicated and the processor in the instantiate template either has no configured controller services or still reflects that it references controller service(s) that do not exist.