Skip to content

Missing required query parameter: api-version when calling client.files.list() #36367

@Yimin-Jin

Description

@Yimin-Jin

Bug: Missing required query parameter: api-version when calling agentsClient.files.list()

Description

When calling agentsClient.files.list(), the SDK throws a RestError with the message "Missing required query parameter: api-version".

Environment

  • Package: @azure/ai-agents
  • Version: 1.1.0

Steps to Reproduce

  1. Create an AgentsClient instance:
const agentsClient = new AgentsClient(baseEndpoint, credentials, {
    apiVersion: '2025-05-15-preview'
});
  1. Call the client.files.list():
agentsClient.files.list
  1. The request fails with:
    RestError: Missing required query parameter: api-version

Workaround

As a temporary workaround, we can manually inject the api-version parameter using a custom pipeline policy:

// Workaround: manually inject api-version parameter via pipeline policy
agentsClient.pipeline.addPolicy(
    {
        name: 'ApiVersionPolicy',
        sendRequest: async (request, next) => {
            const url = new URL(request.url);
            url.searchParams.delete('api-version');
            url.searchParams.set('api-version', apiVersion);
            request.url = url.toString();
            return next(request);
        }
    },
    { afterPhase: 'Serialize' }
);

// Now the client works correctly
const files = await agentsClient.files.list();

Metadata

Metadata

Assignees

Labels

AI AgentsClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions