It looks like a bug in KiCad. It would be nice if anyone else here can verify it too.
To verify, I created a new project with a root sheet and two hierarchical sub sheets. The sub sheets have identical schematic content, because I just copied & pasted it:
And ERC throws this at me:
ERC report (2023-10-31T10:20:04 CET, Encoding UTF8)
***** Sheet /
***** Sheet /asdf/
[label_dangling]: Label not connected to anything
; Severity: error
@(7000,00 mils, 1850,00 mils): Label 'aaa'
[label_dangling]: Label not connected to anything
; Severity: error
@(7000,00 mils, 2000,00 mils): Label 'bbb'
[label_dangling]: Label not connected to anything
; Severity: error
@(7150,00 mils, 2400,00 mils): Label 'bbb'
[label_dangling]: Label not connected to anything
; Severity: error
@(5900,00 mils, 2400,00 mils): Label 'aaa'
[global_label_dangling]: Global label not connected anywhere else in the schematic
; Severity: warning
@(7500,00 mils, 1850,00 mils): Global Label 'aaa'
[global_label_dangling]: Global label not connected anywhere else in the schematic
; Severity: warning
@(7500,00 mils, 2000,00 mils): Global Label 'bbb'
***** Sheet /Untitled Sheet/
[label_dangling]: Label not connected to anything
; Severity: error
@(5000,00 mils, 3500,00 mils): Label 'aaa'
[label_dangling]: Label not connected to anything
; Severity: error
@(6100,00 mils, 3100,00 mils): Label 'bbb'
[label_dangling]: Label not connected to anything
; Severity: error
@(6250,00 mils, 3500,00 mils): Label 'bbb'
[global_label_dangling]: Global label not connected anywhere else in the schematic
; Severity: warning
@(6600,00 mils, 3100,00 mils): Global Label 'bbb'
[label_dangling]: Label not connected to anything
; Severity: error
@(6100,00 mils, 2950,00 mils): Label 'aaa'
[global_label_dangling]: Global label not connected anywhere else in the schematic
; Severity: warning
@(6600,00 mils, 2950,00 mils): Global Label 'aaa'
** ERC messages: 12 Errors 8 Warnings 4
2023-10-31T10:22_asdf_labels.zip (6.0 KB)
In addition, when the resistor with labels part is duplicated on each sheet, ten there are no ERC violations.
My KiCad version:
Application: KiCad x86_64 on x86_64
Version: 7.0.8-7.0.8~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.2.2
FreeType 2.10.1
HarfBuzz 6.0.0
FontConfig 2.13.1
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux Mint 20.3, 64 bit, Little endian, wxGTK, xfce, x11
Build Info:
Date: Sep 30 2023 13:54:09
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.88.1
ngspice: 38
Compiler: GCC 9.4.0 with C++ ABI 1013
Build settings:
KICAD_SPICE=ON