# Getting an 'Invalid typeref' error from swift-reflection-dump

**URL:** <https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394>\
**Category:** Source Tooling\
**Tags:** reflection, swiftui, mirror\
**Created:** [January 22, 2025, 4:28pm UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394 "2025-01-22T16:28:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pookjw](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pookjw/32/33861_2.png) [@pookjw](https://forums.swift.org/u/pookjw)\
**Post date:** [January 22, 2025, 4:28pm UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/1 "2025-01-22T16:28:27Z")

</div>

I built `swift-reflection-dump` using [swift-6.0.3-RELEASE](https://github.com/swiftlang/swift/releases/tag/swift-6.0.3-RELEASE) to dump a SwiftUICore binary, but I'm getting an 'Invalid typeref' error from output. How can I resolve this?

```swift
 /Volumes/Untitled/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/bin/swift-reflection-dump --arch=arm64 /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore > ./SwiftUICore.txt

```

```swift
__C.CGVector
------------
dx: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
 - TypeDecoder.h:1499: Node kind 221 "u¡
" - unexpected kind
dy: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
__C.CGAffineTransform
---------------------
a: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
 - TypeDecoder.h:1499: Node kind 221 "u¡
" - unexpected kind
b: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
 - TypeDecoder.h:1499: Node kind 221 "u¡
" - unexpected kind
c: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
 - TypeDecoder.h:1499: Node kind 221 "u¡
" - unexpected kind
d: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
 - TypeDecoder.h:1499: Node kind 221 "u¡
" - unexpected kind
tx: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡
 - TypeDecoder.h:1499: Node kind 221 "u¡
" - unexpected kind
ty: with unmangled suffix "\x02u\xC1\r\0"
!!! Invalid typeref: u¡

```

---

<div class="post-metadata">

**Author:** ![pookjw](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pookjw/32/33861_2.png) [@pookjw](https://forums.swift.org/u/pookjw)\
**Post date:** [January 23, 2025, 1:26am UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/2 "2025-01-23T01:26:47Z")

</div>

@Kyle-Ye Any idea about this? Thanks.

---

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kyle-ye/32/19686_2.png) [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Post date:** [January 23, 2025, 2:32am UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/3 "2025-01-23T02:32:08Z")

</div>

Looks like you are encountering an error when decoding the `CGAffineTransform` and `CGVector`'s property type

> <https://github.com/swiftlang/swift/blob/6a862d2eb7128ff1f317b07e8ad1a6da939775f3/include/swift/Demangling/TypeDecoder.h#L1499>

And TypeDecoder does not handle the 221 case here.

I'm not familiar with the logic too. Maybe you can try to add another case logic here to just ignore the 221 Node kind (Seems to be `SpecializationPassID`)?

---

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kyle-ye/32/19686_2.png) [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Post date:** [January 23, 2025, 2:33am UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/4 "2025-01-23T02:33:53Z")

</div>

> [@pookjw](#):
>
> SwiftUICore

Also what is the corresponding SDK's SwiftUICore you are trying to dump? iOS 18.0 Beta X or iOS 18.X?

---

<div class="post-metadata">

**Author:** ![pookjw](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pookjw/32/33861_2.png) [@pookjw](https://forums.swift.org/u/pookjw)\
**Post date:** [January 23, 2025, 2:47am UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/5 "2025-01-23T02:47:56Z")

</div>

> [@Getting an 'Invalid typeref' error from swift-reflection-dump](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/4):
>
> Also what is the corresponding SDK's SwiftUICore you are trying to dump? iOS 18.0 Beta X or iOS 18.X?

I am trying with iOS 18.2 Simulator.

---

<div class="post-metadata">

**Author:** ![pookjw](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pookjw/32/33861_2.png) [@pookjw](https://forums.swift.org/u/pookjw)\
**Post date:** [January 23, 2025, 2:51am UTC](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/6 "2025-01-23T02:51:02Z")

</div>

> [@Getting an 'Invalid typeref' error from swift-reflection-dump](https://forums.swift.org/t/getting-an-invalid-typeref-error-from-swift-reflection-dump/77394/3):
>
> Looks like you are encountering an error when decoding the CGAffineTransform and CGVector's property type And TypeDecoder does not handle the 221 case here. I'm not familiar with the logic too. Maybe you can try to add another case logic here to just ignore the 221 Node kind (Seems to be SpecializationPassID)?

Thanks. It seems that `TypeDecoder.decodeMangledType` doesn't handle all node types. This error occurs because `NodeKind::Suffix` is not handled. I'll look into it.
