Skip to content

Data Corrupted Error when listing available runtimes using xcodes 1.6.0 #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ryansobol opened this issue Apr 9, 2025 · 2 comments
Open

Comments

@ryansobol
Copy link

ryansobol commented Apr 9, 2025

I'm seeing the following dataCorrupted error when listing available runtimes using xcodes 1.6.0 and Xcode 16.3:

$ xcodes installed
16.2 (16C5032a)          /Applications/Xcode-16.2.0.app
16.3 (16E140) (Selected) /Applications/Xcode.app

$ xcodes runtimes
Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [_CodingKey(stringValue: "4CE80FD0-5928-4502-A95B-111E4E0F77A0", intValue: nil), CodingKeys(stringValue: "kind", intValue: nil)], debugDescription: "Cannot initialize Kind from invalid String value Cryptex Disk Image", underlyingError: nil))

Does it have anything to do with decoding InstalledRuntime.Kind enum instances due to its case diskImage = "Disk Image" case value?

FWIW, it also happens when Xcode 16.2 is selected as well:

$ xcodes installed
16.2 (16C5032a) (Selected) /Applications/Xcode-16.2.0.app
16.3 (16E140)              /Applications/Xcode.app

$ xcodes runtimes
Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [_CodingKey(stringValue: "4CE80FD0-5928-4502-A95B-111E4E0F77A0", intValue: nil), CodingKeys(stringValue: "kind", intValue: nil)], debugDescription: "Cannot initialize Kind from invalid String value Cryptex Disk Image", underlyingError: nil))
@ryansobol ryansobol changed the title Data Corrupted Error when listing available runtimes using xcodes 1.6.0 and Xcode 16.3 Data Corrupted Error when listing available runtimes using xcodes 1.6.0 Apr 9, 2025
@ryansobol
Copy link
Author

Here's the source of the issue. For whatever reason, both the iOS 18.3 and 18.4 simulator runtimes on my machine have a "kind": "Cryptex Disk Image" JSON property (instead of "kind": "Disk Image" as the InstalledRuntime.Kind.diskImage enum case expects).

FYI, both runtimes were downloaded using Xcode 16.3, which was installed from the Mac App Store the other day.

$ xcrun simctl runtime list -j
{
  "4CE80FD0-5928-4502-A95B-111E4E0F77A0" : {
    "build" : "22E238",
    "deletable" : true,
    "identifier" : "4CE80FD0-5928-4502-A95B-111E4E0F77A0",
    "kind" : "Cryptex Disk Image",
    "lastUsedAt" : "2025-04-09T20:08:04Z",
    "mountPath" : "\/Library\/Developer\/CoreSimulator\/Volumes\/iOS_22E238",
    "parentIdentifier" : "082BCE77-A0A7-4B9D-8E46-FCF95CBBC03F",
    "parentImagePath" : "\/System\/Library\/AssetsV2\/com_apple_MobileAsset_iOSSimulatorRuntime\/6fb1e5fe25ee1c372f7116516e615c556906bd4e.asset\/AssetData\/090-44150-318.dmg",
    "parentMountPath" : "\/Library\/Developer\/CoreSimulator\/Cryptex\/Images\/bundle\/SimRuntimeBundle-082BCE77-A0A7-4B9D-8E46-FCF95CBBC03F",
    "path" : "\/Library\/Developer\/CoreSimulator\/Cryptex\/Images\/bundle\/SimRuntimeBundle-082BCE77-A0A7-4B9D-8E46-FCF95CBBC03F\/Restore\/090-44334-323.dmg",
    "platformIdentifier" : "com.apple.platform.iphonesimulator",
    "runtimeBundlePath" : "\/Library\/Developer\/CoreSimulator\/Volumes\/iOS_22E238\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 18.4.simruntime",
    "runtimeIdentifier" : "com.apple.CoreSimulator.SimRuntime.iOS-18-4",
    "signatureState" : "Verified",
    "sizeBytes" : 8825558354,
    "state" : "Ready",
    "version" : "18.4"
  },
  "14405200-BE84-422E-A1E1-33FEC94E6467" : {
    "build" : "22D8075",
    "deletable" : true,
    "identifier" : "14405200-BE84-422E-A1E1-33FEC94E6467",
    "kind" : "Cryptex Disk Image",
    "lastUsedAt" : "2025-04-09T20:11:31Z",
    "mountPath" : "\/Library\/Developer\/CoreSimulator\/Volumes\/iOS_22D8075",
    "parentIdentifier" : "10DEE75B-7D05-4479-B71F-237DB9F83FE0",
    "parentImagePath" : "\/System\/Library\/AssetsV2\/com_apple_MobileAsset_iOSSimulatorRuntime\/fb8de9a3438213a1dda310a6ab5eac9ddf8db858.asset\/AssetData\/044-77235-048.dmg",
    "parentMountPath" : "\/Library\/Developer\/CoreSimulator\/Cryptex\/Images\/bundle\/SimRuntimeBundle-10DEE75B-7D05-4479-B71F-237DB9F83FE0",
    "path" : "\/Library\/Developer\/CoreSimulator\/Cryptex\/Images\/bundle\/SimRuntimeBundle-10DEE75B-7D05-4479-B71F-237DB9F83FE0\/Restore\/044-77188-048.dmg",
    "platformIdentifier" : "com.apple.platform.iphonesimulator",
    "runtimeBundlePath" : "\/Library\/Developer\/CoreSimulator\/Volumes\/iOS_22D8075\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 18.3.simruntime",
    "runtimeIdentifier" : "com.apple.CoreSimulator.SimRuntime.iOS-18-3",
    "signatureState" : "Verified",
    "sizeBytes" : 8708125252,
    "state" : "Ready",
    "version" : "18.3.1"
  }
}

@ryansobol
Copy link
Author

ryansobol commented Apr 9, 2025

I don't mind submitting a PR to fix this issue, but I'm new to xcodes, and am not sure how you'd prefer to handle this logic if case cryptexDiskImage = "Cryptex Disk Image" was added to the InstalledRuntime.Kind enum.

if runtime.state == .legacyDownload || runtime.state == .diskImage {
    str += " (Installed)"
} else if runtime.state == .bundled {
    str += " (Bundled with selected Xcode)"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant