Question about behavior of paste special "Keep existing reference designators..."


I am running into an issue when trying to copy a schematic while keeping the reference designators the same. The issue is the paste special with the selection “keep existing reference designators the same” is pasting the symbols with the “wrong” reference designator.
Example i have caps C1,C2,C3 and when copied and pasted instead of pasting as C1, C2, C3. I get C1, C1,C1.
Steps to replicate

  1. Open new project
  2. place part in root sheet. i used capacitor C1
  3. create new hierarchical sheet
  4. cut the part C1 and paste it into the new sheet
  5. change the ref des of the part in the new sheet to Cx
  6. copy part and paste special “keeping reference designators the same”
  7. The result will be C1 instead of Cx
    This seems to be because an “instance” in the S expression in the kicad .sch file still exists thinking that C1 exists so it looks like this
    (project “TESTING”
    (path “/989b46f3-c56f-49a1-990e-4015c57ec3e8”
    (reference “C1”) (unit 1)
    (path “/989b46f3-c56f-49a1-990e-4015c57ec3e8/c194c57c-d674-46c0-a6f7-3811d22378ec”
    (reference “C5”) (unit 1)

So it seems C5 exists in my new sheet but also C1 still exists in my root sheet and when i copy and paste it is using C1 instead of C5?
Once i deleted C1 in the root sheet should the instance of it in the root sheet disappear?

I don’t know if this is a bug or it actually is the desirable outcome for the typical use case. i understand i made the mistake and had to cut and paste a symbol from one place to another so but i do feel like once i cut that symbol and paste it elsewhere it should have no reference to the original sheet it was in.

Kicad version if that helps
Application: KiCad Schematic Editor x64 on x64
Version: 7.0.7, release build
wxWidgets 3.2.2
FreeType 2.12.1
HarfBuzz 6.0.0
FontConfig 2.14.1
libcurl/7.88.1-DEV Schannel zlib/1.2.13
Platform: Windows 10 (build 19045), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Aug 14 2023 02:42:39
wxWidgets: 3.2.2 (wchar_t,wx containers)
Boost: 1.81.0
OCC: 7.7.1
Curl: 7.88.1-DEV
ngspice: 40
Compiler: Visual C++ 1936 without C++ ABI
Build settings:

This my first post so just wanted to also say thanks to all the Kicad community for the great software that is Kicad!

I am guessing there are some bugs in the Paste Special function, but a thread I started about this a month ago did not get much response:

Following your description I get the same result. Looks like a bug.
Could be issue Paste Special/Keep Existing References doesn't handle multiple sheet instances (#14825) · Issues · KiCad / KiCad Source Code / kicad · GitLab

standard advice for new forum users: read New Member Information
If you follow the instructions you could promote yourself to the next user level (basic user) and are then allowed to attach multiple pictures + example projects in your threads.

The problem is worse than the three above issues.

Place parts on Root.

Copy Root > Paste Sp. to Sheet > Result OK

Change Sheet then Copy > Paste Sp. to same Sheet > Result Original Root.

Change Root then Copy > Paste Sp. to Sheet (along side the first Paste Sp. to sheet) > Result First Paste Sp. retains its annotation but new Paste Sp. shows original Root (which no longer exists) instead of changed Root.

Save was used after every change and paste Sp.

@paulvdh I have never had that issue of no RefDes but if in the scenario i explained i delete the initial ref des on the root page and make it C?, then paste it in new sheet, with an auto assigned ref des. once i try to copy and paste that, i get C? . maybe your part also has its first instance as a “C?”

@mf_ibfeew thanks for the tip and showing me the bug report. i kept googling and searching on the forum for stuff related to “keep existing references…” . I guess i should have focused my searching on the “paste special” keyword.

@jmk yeah the issue does seem to come up in many different ways. i dont know all the ways that multiple “instances” of parts in different sheets get into the S expressions in the schematic file. so probably lots of ways to reach this bug

Well thanks for the help everyone. Glad that im not the first person to run into this issue. I am trying to make a bunch of building blocks of schematics that i can copy and paste. so i knew what i was doing might not be the totally typical use case.


I have been struggling with this issue as well for some time now. I copied a block of components from a schematic and pasted it into a text editor to see if I could figure out what was happening. In the text I found references to several components that I have used in other designs but not in the one I was working on. I’m sure I used it successfully in earlier versions but I can’t pinpoint when the change happened. It’s something that really needs to be looked at.