error: type for self cannot be reconstructed: type for typename

Hi,

i have met error below when i tried to po one attributes of an instance in my Xcode lldb:

error: type for self cannot be reconstructed: type for typename "$xxxxx" was not found (cached)
error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work.

Is there anybody met the same error before? I urgently want to know why this happen and how to fix this issue.

My macOS Version is Sequoia v15.0.1, Xcode16.0. This problem showed after i upgraded my macOS and Xcode version.

Encountering the same issue on Sonoma 14.6.1 (23G93) and Xcode 16.0 (16A242d). Seems this one is more like Xcode-related. As for me it sometimes get fixed after navigating through code using "steps" (step over/step into, etc.) and attempting to print object one more time, even after such error.

Report after running swift-healthcheck in lldb contains such errors like:

SwiftASTContextForExpressions(module: "ModuleName", cu: "MyFile.swift")::MyMethod() -- Missing Swift module or Clang module found for "ModuleName", "imported" via SwiftDWARFImporterDelegate. Hint: Register Swift modules with the linker using -add_ast_path.

Seems like suggested hint could solve the problem, but before upgrading to new Xcode I didn't have such issue.

same problem

Xcode Version 16.0 (16A242d)

Mac 15.0.1 (24A348)

Report after running swift-healthcheck in lldb contains such errors like:

Correct.

I also have report like you after swift-healthcheck:

SwiftASTContextForExpressions(module: "moduleName", cu: "MySwiftName.swift")::LoadOneModule() -- Missing Swift module or Clang module found for "moduleName", "imported" via SwiftDWARFImporterDelegate. Hint: Register Swift modules with the linker using -add_ast_path.

My Xcode project works fine in before i upgraded my macOS and Xcode. Actually i didn't do anything after i upgraded to macOS v15.0.1(24A348), Xcode 16.0(16A242d) except fix compilation problem.

There is a possibly solution for this issue(just like you sard, the hint), but it did't work for me actually and i still try to figure it out. I wonder how could you solve the problem specifically.

Thanks.

Same. macOS: Sonoma 14.6.1, Xcode: 16.0 16A242d

I’m curious about the build systems everyone is using in this thread. We use a custom build system with remotely built static frameworks. I'm starting to encounter the same issue since Xcode 16.

-add_ast_path didn't help.

I also have a lot of logs like this when app becomes paused by lldb:

/Users/egormerkushev/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/23S4HX6OW8E8S/MyModule-2XYB5G9W7D2Z.pcm is out-of-date (hash mismatch). Type information from this module may be incomplete or inconsistent with the rest of the program. Rebuilding the project will regenerate the needed module files.

When I try print something I get it:

(lldb) po self
0x000000015d9de300
(lldb) po self.dismissGestureRecognizer
error: type for self cannot be reconstructed: type for typename "$s5MyModule31FullscreenContentViewControllerCD" was not found (cached)
error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work.

Same problem with Xcode 16.0, everything was ok with Xcode 15.4. Not find work around yet

error: type for self cannot be reconstructed: type for typename
 
 
Q