Skip to content

Clarify the error for image inputs being unsupported#14

Open
egourlao wants to merge 2 commits into
mainfrom
egourlaouen/specific-errors-image-input-unsupported
Open

Clarify the error for image inputs being unsupported#14
egourlao wants to merge 2 commits into
mainfrom
egourlaouen/specific-errors-image-input-unsupported

Conversation

@egourlao

Copy link
Copy Markdown
Contributor

When trying to use image inputs, we now use a different error for those two cases:

  • If the package was built using an Xcode version that doesn't include the macOS 27 SDK (and thus, won't include image inputs) ;
  • If the package was built with an Xcode version that includes image inputs, but that the host macOS version doesn't support image inputs.

egourlao added 2 commits June 18, 2026 16:13
The error message should be self-explanatory.
@egourlao egourlao requested review from li3zhen1, mkery and rxwei June 18, 2026 23:21
Comment on lines +82 to +86
} catch ComposedPromptError.unsupportedOS {
error?.pointee = FMComposedPromptAddImageErrorUnsupportedOS
return false
} catch ComposedPromptError.unsupportedSDK {
error?.pointee = FMComposedPromptAddImageErrorUnsupportedSDK

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this really be within the responsibilities of the C bindings? This is not really bridging anything from the Swift framework. Is it at all possible to detect OS/SDK mismatches from the Python side?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we didn't have to maintain this piping code in the Swift package, but I couldn't quite find any viable alternatives that include the image input functionality for macOS 27 users, without breaking builds of the package for users still using the macOS 26 SDK. Looked into accessing the symbols dynamically using dlsym, but it doesn't seem to work well with Swift structs like Attachment. We could also maintain two versions of our package (one using the macOS 27 symbols, one without), but it might then just mean more friction when installing the package. Have any other ideas?

Ultimately, we can always remove this code if we don't feel good about adding this in our bindings, but it'll just mean that it might be harder for a user to understand why image attachments are unsupported, especially in edge cases such as when they're using a macOS 26 SDK on a macOS 27 machine. We could consider other mitigations like logging on pip install.

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

Successfully merging this pull request may close these issues.

2 participants