Sketchtool Bus Error

Hi there, when attempting to run sketchtool on the command line I’m getting a bus error. It seems to occur solely when opening files.

This is the command and output:

/Applications/Sketch.app/Contents/MacOS % ./sketchtool list pages /Users/ryanconnolly/Downloads/sketchfile.sketch
objc[26582]: Class MSAssetCollection is implemented in both /System/Library/PrivateFrameworks/CoreMediaStream.framework/Versions/A/CoreMediaStream (0x1e72df3d0) and /Applications/Sketch.app/Contents/Frameworks/SketchModel.framework/Versions/A/SketchModel (0x104675fa0). One of the two will be used. Which one is undefined.
zsh: bus error  ./sketchtool list pages /Users/ryanconnolly/Downloads/sketchfile.sketch

I ran the command in LLDB and recieved a pretty lengthy backtrace. Here are the first few frames:

  * frame #0: 0x000000000bad4007
    frame #1: 0x000000019ad05998 ImageIO`PNGReadPlugin::InitializePluginData(IIOImageReadSession*, IIODictionary*, IIODictionary*, CGImageMetadata*, CGColorSpace**, ReadPluginData&, PNGPluginData&, __CFDictionary*) + 820
    frame #2: 0x000000019acfdda4 ImageIO`IIOReadPlugin::callInitialize() + 388
    frame #3: 0x000000019acfdb7c ImageIO`IIO_Reader::initImageAtOffset(CGImagePlugin*, unsigned long, unsigned long, unsigned long) + 124
    frame #4: 0x000000019acfb340 ImageIO`IIOImageSource::makeImagePlus(unsigned long, IIODictionary*) + 808
    frame #5: 0x000000019ad07bb4 ImageIO`IIOImageSource::createImageAtIndex(unsigned long, IIODictionary*) + 100
    frame #6: 0x000000019ad078a0 ImageIO`CGImageSourceCreateImageAtIndex + 336
    frame #7: 0x00000001021d3d80 SketchModel`MSImageDataCreateCGImageFromData + 88
    frame #8: 0x00000001021d2e28 SketchModel`-[MSImageData initWithData:sha:] + 132
    frame #9: 0x00000001021d4458 SketchModel`+[MSImageData decodeReferenceFromJSONZipArchive:withReference:] + 272
    frame #10: 0x000000010220b1f4 SketchModel`-[MSJSONFileReference initWithJSONDecoder:] + 200
    frame #11: 0x0000000100937760 BCFoundation`-[BCJSONDecoder decodeDictionary:] + 360
    frame #12: 0x00000001009379d8 BCFoundation`-[BCJSONDecoder decodeObject:] + 68
    frame #13: 0x0000000100936e8c BCFoundation`-[BCJSONDecoder decodeObjectForKey:] + 104
    frame #14: 0x000000010220a3f0 SketchModel`-[MSJSONUnarchiver decodeObjectOfClasses:forKey:] + 140
    frame #15: 0x000000010220a334 SketchModel`-[MSJSONUnarchiver decodeObjectOfClass:forKey:] + 84
    frame #16: 0x000000010213dcc8 SketchModel`$s11SketchModel23_MSImmutableBitmapLayerC16decodeProperties4withySo16MSBaseUnarchiverC_tF + 336
    frame #17: 0x000000010213deac SketchModel`___lldb_unnamed_symbol36361 + 52
    frame #18: 0x0000000102264984 SketchModel`-[MSImmutableModelObject decodePropertiesPreservingUnknownsWithUnarchiver:] + 44
    frame #19: 0x0000000102264f34 SketchModel`__69-[MSImmutableModelObject initWithUnarchiver:migratingFrom:toVersion:]_block_invoke + 28
    frame #20: 0x00000001022647b0 SketchModel`-[MSImmutableModelObject initWithUnarchiver:decodeBlock:] + 124
    frame #21: 0x0000000102264920 SketchModel`-[MSImmutableModelObject initWithUnarchiver:migratingFrom:toVersion:] + 136
    frame #22: 0x00000001022505a4 SketchModel`-[MSBaseUnarchiver instanciateObject:] + 212
    frame #23: 0x000000010220ae80 SketchModel`-[NSObject(BCJSONDecoding) initWithJSONDecoder:] + 52
    frame #24: 0x0000000100937760 BCFoundation`-[BCJSONDecoder decodeDictionary:] + 360
    frame #25: 0x00000001009379d8 BCFoundation`-[BCJSONDecoder decodeObject:] + 68
    frame #26: 0x0000000100919990 BCFoundation`-[NSArray(BCFoundation) compactMap:] + 216
    frame #27: 0x0000000100937980 BCFoundation`-[BCJSONDecoder decodeArray:] + 76
    frame #28: 0x0000000100937a0c BCFoundation`-[BCJSONDecoder decodeObject:] + 120
    frame #29: 0x0000000100936e8c BCFoundation`-[BCJSONDecoder decodeObjectForKey:] + 104
    frame #30: 0x000000010220a3f0 SketchModel`-[MSJSONUnarchiver decodeObjectOfClasses:forKey:] + 140
    frame #31: 0x000000010227ca80 SketchModel`-[_MSImmutableLayerGroup decodePropertiesWithUnarchiver:] + 380
    frame #32: 0x0000000102264984 SketchModel`-[MSImmutableModelObject decodePropertiesPreservingUnknownsWithUnarchiver:] + 44
    frame #33: 0x0000000102264f34 SketchModel`__69-[MSImmutableModelObject initWithUnarchiver:migratingFrom:toVersion:]_block_invoke + 28
    frame #34: 0x00000001022647b0 SketchModel`-[MSImmutableModelObject initWithUnarchiver:decodeBlock:] + 124
    frame #35: 0x0000000102264920 SketchModel`-[MSImmutableModelObject initWithUnarchiver:migratingFrom:toVersion:] + 136
    frame #36: 0x00000001022505a4 SketchModel`-[MSBaseUnarchiver instanciateObject:] + 212
    frame #37: 0x000000010220ae80 SketchModel`-[NSObject(BCJSONDecoding) initWithJSONDecoder:] + 52
    frame #38: 0x0000000100937760 BCFoundation`-[BCJSONDecoder decodeDictionary:] + 360
    frame #39: 0x00000001009379d8 BCFoundation`-[BCJSONDecoder decodeObject:] + 68
    frame #40: 0x0000000100919990 BCFoundation`-[NSArray(BCFoundation) compactMap:] + 216
    frame #41: 0x0000000100937980 BCFoundation`-[BCJSONDecoder decodeArray:] + 76
    frame #42: 0x0000000100937a0c BCFoundation`-[BCJSONDecoder decodeObject:] + 120
    frame #43: 0x0000000100936e8c BCFoundation`-[BCJSONDecoder decodeObjectForKey:] + 104
    frame #44: 0x000000010220a3f0 SketchModel`-[MSJSONUnarchiver decodeObjectOfClasses:forKey:] + 140
    frame #45: 0x000000010227ca80 SketchModel`-[_MSImmutableLayerGroup decodePropertiesWithUnarchiver:] + 380
    frame #46: 0x0000000102264984 SketchModel`-[MSImmutableModelObject decodePropertiesPreservingUnknownsWithUnarchiver:] + 44
    frame #47: 0x0000000102264f34 SketchModel`__69-[MSImmutableModelObject initWithUnarchiver:migratingFrom:toVersion:]_block_invoke + 28
    frame #48: 0x00000001022647b0 SketchModel`-[MSImmutableModelObject initWithUnarchiver:decodeBlock:] + 124
    frame #49: 0x0000000102264920 SketchModel`-[MSImmutableModelObject initWithUnarchiver:migratingFrom:toVersion:] + 136

I’m not sure if the above MSAssetCollection warning is related, but have included it anyway.
I’m using the trial version, not sure if that makes a difference.

Operating system: Sonoma 14.1.2

Any help is appreciated.

Thanks

Hello @ryaan! :wave:

Thanks a lot for gathering this information for us! I’ve already passed this on internally, but I would like to verify something.

We’ve been recently working on this MSAssetCollection error, and I’m happy to say that we’ve found where the issue was and added a fix in the beta version. It will be integrated into the next release, but if you wish to, you can test it right now by downloading the beta version here).

Note: Please carefully read the disclaimer on the beta page before proceeding. As always, we recommend using these builds with copies of your Documents, just in case.

That would help us to confirm if this solves the issue you are currently experiencing.

Thanks for the reply. I tried the Beta version and the MSAssetCollection warning is gone, but the bus error remains.

Interesting… Then this is a new issue on its own.

I will open an investigation to analyze this issue, but we would need a little bit more context on the situation. Could you send us the document you are reproducing this with?

(If you can’t share it publicly here, let me know, and you can send it to me via the productsupport@sketch.com email).

Cheers! :pray:

test3.sketch (5.1 KB)
Attached is a simple document I created that replicates the issues.

This is the command and output.

(base) ?138 ~/Downloads/Sketch Beta.app/Contents/MacOS % ./sketchtool export preview /Users/ryanconnolly/Documents/test3.sketch
zsh: bus error ./sketchtool export preview /Users/ryanconnolly/Documents/test3.sketch

Thanks for the feedback, @ryaan

Let us investigate a little bit, and I’ll get back to you with any new information! :smile:

Interesting… I’ve tried to reproduce the issue on my system, but I don’t receive any error like that :thinking:

Not with the “list pages” or “export preview” commands:

I can see that you are using this path:

~/Downloads/Sketch Beta.app/Contents/MacOS % ./sketchtool export preview

And I’m using this one:

/Applications/Sketch Beta.app/Contents/Resources/sketchtool/bin/sketchtool export preview

Could you try it out and see if the outcome is different?

Cheers! :pray: