Skip to content

[BUG] Image file upload throws exception while invoking image analysis #709

@justinyoo

Description

@justinyoo

Describe the bug

Unhandled exception. System.ClientModel.ClientResultException: HTTP 400 (invalid_request_error: )
Parameter: input

Invalid input: Expected file type to be a supported format: .pdf but got .png.

Steps to reproduce

  1. Run this code: https://github.com/justinyoo/openai-dotnet/blob/docs/images-vision/docs/guides/images-vision/responses/analyze_images_passing_file.cs
  2. See the error below:
Unhandled exception. System.ClientModel.ClientResultException: HTTP 400 (invalid_request_error: )
Parameter: input

Invalid input: Expected file type to be a supported format: .pdf but got .png.
   at OpenAI.ClientPipelineExtensions.ProcessMessage(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
   at OpenAI.Responses.OpenAIResponseClient.CreateResponse(BinaryContent content, RequestOptions options)
   at OpenAI.Responses.OpenAIResponseClient.CreateResponse(IEnumerable`1 inputItems, ResponseCreationOptions options, CancellationToken cancellationToken)
   at Program.<Main>$(String[] args) in C:\Users\justi\dev\gh\openai-dotnet\docs\guides\images-vision\responses\analyze_images_passing_file.cs:line 23
   at Program.<Main>(String[] args)

Code snippets

Here's the code snippet link: https://github.com/justinyoo/openai-dotnet/blob/docs/images-vision/docs/guides/images-vision/responses/analyze_images_passing_file.cs

OS

Windows

.NET version

.NET 10 RC1

Library version

2.4

Metadata

Metadata

Assignees

Labels

area: imagesThis item is related to Images.needs-author-feedbackWorkflow: More information is needed from author to address the issue.questionCategory: The issue is seeking information about the library or its usage.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions