"Wires not connected to anything" only occurs when kicad_sch file is opened outside of a project

Description

I have a project, containing a root sheet, and two child sheets. When I open the project and run ERC, there are zero errors/warnings. However, when I close the project and open up one of the child sheets (by right-clicking in Windows File Explorer and selecting Open With->KiCad Schematic Editor 8.0) and then run ERC, I see the the "Wires not connected to anything" error for two wires that are connected.

Incidentally, if you're wondering why I'm opening the file outside of the project: the reason why I desire to open the sheet outside of the project, is so that I can ultimately simulate it individually. The simulation doesn't work correctly because of the "wires not connected to anything" errors. I appreciate that it is possible to simulate portions by right-clicking on circuitry and selecting Exclude from Simulation, but I'm trying to come up with a better workflow where I can simply not simulate the root sheet, and simulate only the specific child sheets that require simulation, separately.

Here's the ERC when the project is open as normal. As can be seen, there is a root sheet and two child sheets. The ERC output is zero errors/warnings.

project-erc.jpg

Next, I close the KiCad project. Then, I make a copy of the child sheet called diff_amp_gain_stages.kicad_sch (I called the copy test.kicad_sch) so that I don't accidentally corrupt the original file.

Then, I right-click to open the file outside of the project (note: the screenshot states 8.0.0 but it's actually 8.0.4, I only have the latest 8.0.4 release on my PC, but my shortcut still states 8.0.0):

open-with.jpg

When the sheet is open, I run the ERC on it. As can be seen in the screenshot below, there are "Wires not connected to anything" errors introduced. They don't make sense. Those wires are connected.

sheet-erc-outside-of-project.jpg

As can be seen from the screenshots, the issue is that there are no ERC errors in the project, but the individual sheet (opened outside of a project) has "wires not connected to anything" errors that I cannot seem to fix in any way. I have tried deleting the wires and reconnecting them. The grid is always set to 1.27. The issue however persists. This issue is reproduceable. I have supplied my project (in a zipped up file) below.

For more background, see:

https://forum.kicad.info/t/sim-behaving-unexpectedly-seems-to-be-related-to-hierarchical-labels/53873

Steps to reproduce

  1. Open the following project:

    meas_amp_4.zip

  2. Run ERC, and observe that there are zero errors/warnings

  3. Close the project.

  4. In a file explorer (I used Windows Explorer) copy the child sheet called diff_amp_gain_stages.kicad_sch and save it to a different filename (e.g. test.kicad_sch)

  5. Right-click on the test.kicad_sch file, and select Open With and select KiCad Schematic Editor 8.0

  6. When the file opens, run the ERC. Observe the new errors relating to "wires not connected to anything" are internal wires within the sheet that are definitely connected. This is a problem because it means I cannot simulate that sheet in isolation from the rest of the project.

KiCad Version

Application: KiCad x64 on x64

Version: 8.0.4, release build

Libraries:
	wxWidgets 3.2.5
	FreeType 2.12.1
	HarfBuzz 8.3.0
	FontConfig 2.14.2
	libcurl/8.5.0-DEV Schannel zlib/1.3

Platform: Windows 11 (build 22631), 64-bit edition, 64 bit, Little endian, wxMSW
OpenGL: Intel, Intel(R) UHD Graphics 620, 4.6.0 - Build 30.0.101.1339

Build Info:
	Date: Jul 17 2024 03:26:47
	wxWidgets: 3.2.5 (wchar_t,wx containers)
	Boost: 1.83.0
	OCC: 7.8.1
	Curl: 8.5.0-DEV
	ngspice: 42
	Compiler: Visual C++ 1939 without C++ ABI

Build settings:
Edited by Shabaz