---
id: change/bcapps/9531
type: change
title: '#9531 [Master]- Report 152 "Calculate Low Level Code" terminates with error: "Cannot add instance as another with key %1 has already been added." after upgrade to v28.1'
summary: Report 152 now correctly handles items with multiple SKUs sharing the same Production BOM by replacing enumeration-based lookup with a direct dictionary key search in the BOM tree node logic.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit bom tree node
  - codeunit bom tree node dictionary
  - codeunit bom tree node dictionary impl.
system: inventory
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:12:18.987Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 3183d7d36954fb8f377f36dc12602ec61dc0932a
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9531
    title: 'microsoft/BCApps#9531: [Master]- Report 152 "Calculate Low Level Code" terminates with error: "Cannot add instance as another with key %1 has already been added." after upgrade to v28.1'
    date: "2026-07-17"
    commit: 3183d7d36954fb8f377f36dc12602ec61dc0932a
    t: null
    quote: Replaced the enumeration in IsChild with a direct O(1) key lookup.
links:
  learn: []
  objects:
    - object/codeunit/3684
    - object/codeunit/3675
    - object/codeunit/3676
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9531
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9531
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-17T08:40:51Z"
author: DhavalMore88
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Team: SCM"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 4
  additions: 72
  deletions: 8
  al: 3
apps:
  - Base Application
objects_touched:
  - key: codeunit/3684
    page: codeunit/3684
    type: codeunit
    id: 3684
    name: BOM Tree Node
    app: Base Application
    status: modified
  - key: codeunit/3675
    page: codeunit/3675
    type: codeunit
    id: 3675
    name: BOM Tree Node Dictionary
    app: Base Application
    status: modified
  - key: codeunit/3676
    page: codeunit/3676
    type: codeunit
    id: 3676
    name: BOM Tree Node Dictionary Impl.
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 642311
systems:
  - inventory
quote: Replaced the enumeration in IsChild with a direct O(1) key lookup.
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9531 [Master]- Report 152 "Calculate Low Level Code" terminates with error: "Cannot add instance as another with key %1 has already been added." after upgrade to v28.1

> Report 152 now correctly handles items with multiple SKUs sharing the same Production BOM by replacing enumeration-based lookup with a direct dictionary key search in the BOM tree node logic.

[Pull request](https://github.com/microsoft/BCApps/pull/9531) · merged into `main` (BC30) on 2026-07-17 by DhavalMore88 (community contribution) · 4 files (+72 -8), 3 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Fixed a regression where Report 152 crashed when an item and its SKUs referenced the same Production BOM
- Changed IsChild procedure from enumeration-based to O(1) key lookup to avoid leaving the shared enumerator in an incorrect state
- Added regression test for items with multiple SKUs sharing one Production BOM
- The issue occurred because exiting mid-enumeration left the shared enumerator stranded, preventing duplicate detection
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 3684 "BOM Tree Node"](../../objects/codeunit/3684.md), Base Application: modified
- [Codeunit 3675 "BOM Tree Node Dictionary"](../../objects/codeunit/3675.md), Base Application: modified
- [Codeunit 3676 "BOM Tree Node Dictionary Impl."](../../objects/codeunit/3676.md), Base Application: modified

## Context

- Work items: AB#642311
- Labels: ADO: Sync, From Fork, Team: SCM
- Systems: inventory
- From the description: "Replaced the enumeration in IsChild with a direct O(1) key lookup."

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
