Skip to content

[BUG] CreateAutomaticContainerConfiguration throws ArgumentNullException #714

@stephentoub

Description

@stephentoub

Describe the bug

CreateAutomaticContainerConfiguration is defined like:

public static AutomaticCodeInterpreterToolContainerConfiguration CreateAutomaticContainerConfiguration(IEnumerable<string> fileIds = null)

where the fileIds argument defaults to null, but the implementation dereferences it without checking for null:

fileIds: fileIds.ToList()

so if you call it without any parameters, it throws an ArgumentNullException from inside of Enumerable.ToList.

Steps to reproduce

This:

#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using OpenAI.Responses;

CodeInterpreterToolContainerConfiguration.CreateAutomaticContainerConfiguration();

results in this:

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at OpenAI.Responses.CodeInterpreterToolContainerConfiguration.CreateAutomaticContainerConfiguration(IEnumerable`1 fileIds)
   at Program.<Main>$(String[] args)

Code snippets

OS

All

.NET version

.NET 10

Library version

2.5.0

Metadata

Metadata

Assignees

Labels

area: responsesThis item is related to ResponsesbugCategory: Something isn't working and appears to be a defect in the client library.issue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions