Error When Adding Sub-Assembly in BOM Creator – "Parent Row Not Found" and Background Job Fails

Hi everyone,

I’m facing a recurring issue while trying to create a BOM using the BOM Creator in ERPNext.

Whenever I add a sub-assembly (semi-finished item), I get the following error message on the screen:

Parent Row not found for 1TESTBOM1

Even though I receive this error, the sub-assembly is still visible in the background (it appears under the product tree). However, when I try to add another sub-assembly after clicking “Rebuild Tree,” the same error appears again.

If I ignore the errors and proceed to submit the BOM, no BOMs are actually created. I checked the background jobs and found that they are failing with a traceback error.

Here’s the traceback:
Traceback (most recent call last):
File “/home/frappe/frappe-bench/env/lib/python3.12/site-packages/rq/worker.py”, line 1428, in perform_job
rv = job.perform()
^^^^^^^^^^^^^
File “/home/frappe/frappe-bench/env/lib/python3.12/site-packages/rq/job.py”, line 1278, in perform
self._result = self._execute()
^^^^^^^^^^^^^^^
File “/home/frappe/frappe-bench/env/lib/python3.12/site-packages/rq/job.py”, line 1315, in _execute
result = self.func(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py”, line 222, in execute_job
retval = method(**kwargs)
^^^^^^^^^^^^^^^^
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/bom_creator/bom_creator.py”, line 256, in create_boms
production_item_wise_rm[(row.fg_item, row.fg_reference_id)][“items”].append(row)
KeyError: (‘MD019A’, ‘sas2bnudkq’)

Any idea why this is happening and how I can resolve it?

Thanks in advance!