Blocks may override their automatically generated item using the minecraft:block_placer component’s replace_block_item property. Items (from blocks or not) may specify that they should not be present in command auto-completions using the following code: "menu_category": {"category": "none", "is_hidden_in_commands": true}.
This code is respected for normal items but not for overridden block items. This is important, as some Vanilla blocks conceal their items from commands without concealing their blocks from such. Double slabs are a key example of this.
Note that despite the improper inclusion in the items enum, commands referencing hidden overridden items will correctly fail. Also note that this situation does not occur when using the menu_category code above on a block without an overridden item, strongly indicating custom block items being included in the enum occurs because item override code is not analyzed for such.
Demonstration
The 3 attached screenshots demonstrate this issue. A custom block has been created that is not itself hidden from commands; however, its item is. Both the block and item appear in the respected command completions, indicating inclusion in both generated enums. The item inclusion is a bug, and although completions indicate validity, execution of commands using such fails.
Reproduction
This demo screenshots are taken from the behavior pack in the attached world for convenience. This world can be opened (in Minecraft Preview) for inspection or unzipped to access the code associated with such.
Thank you for helping us improve Minecraft! We saved your files: