Skip to content

client.agents.files.upload_and_poll() raises JSON is invalid: Expecting value: line 1 column 1 (char 0) empty response body on async client #45667

@AyushTripathi07

Description

@AyushTripathi07

Description

I am on the v1 beta of the SDK (azure-ai-agents==1.1.0b4, azure-ai-projects==1.0.0b11) and using client.agents.files.upload_and_poll() to upload a file before creating a vector store. This call now fails with a raw json.JSONDecodeError, suggesting the response body coming back from the service is empty or non-JSON.

Looking at the newly released v2.0.0 docs, it appears the file upload API has moved to a completely different surface (openai_client.files.create()). My question is: is there no backward compatibility maintained for v1 beta users? If the endpoint was changed or deprecated, the SDK should surface a meaningful error rather than a raw JSON parse failure.

Observed Logs

INFO:azure.identity._credentials.managed_identity:ManagedIdentityCredential will use IMDS
INFO:azure.identity._credentials.chained:DefaultAzureCredential acquired a token from AzureCliCredential
ERROR: Error processing file document.pdf: JSON is invalid: Expecting value: line 1 column 1 (char 0)
<binary garbage bytes in response>

Authentication succeeds — DefaultAzureCredential resolves to AzureCliCredential and acquires a token correctly. The failure is in the HTTP response body of the file upload call itself.

Code (v1 beta — what I am running)

Client setup (async)

from azure.ai.projects.aio import AIProjectClient
from azure.identity import DefaultAzureCredential

client = AIProjectClient(
    endpoint="https://<endpoint>.services.ai.azure.com/api/projects/<project>",
    credential=DefaultAzureCredential()
)

File upload — the exact failing call

from azure.ai.projects.models import FilePurpose

# ❌ Fails: JSON is invalid: Expecting value: line 1 column 1 (char 0)
file_obj = await client.agents.files.upload_and_poll(
    file_path="/tmp/document.pdf",
    purpose=FilePurpose.AGENTS
)

Vector store creation (never reached — upload fails first)

vector_store = await client.agents.vector_stores.create_and_poll(
    file_ids=[file_obj.id]
)

Thread with vector store attached (downstream, also never reached)

from azure.ai.agents.models import ToolResources, FileSearchToolResource

thread = await client.agents.threads.create(
    tool_resources=ToolResources(
        file_search=FileSearchToolResource(
            vector_store_ids=[vector_store.id]
        )
    )
)

await client.agents.messages.create(
    thread_id=thread.id,
    role="user",
    content="Analyse the uploaded document."
)

run = await client.agents.runs.create_and_process(
    thread_id=thread.id,
    agent_id=agent_definition.id
)

The Core Question

  1. Is there no backward compatibility between azure-ai-agents==1.1.0b4 / azure-ai-projects==1.0.0b11 and v2.0.0?

  2. If the client.agents.files.upload_and_poll() endpoint has been deprecated or its response contract changed — why is the method still present in 1.1.0b4 without any deprecation warning? It silently returns an empty/binary body instead of raising a DeprecationWarning or a meaningful SDKError.

  3. Is there a migration guide from v1 beta to v2, specifically covering:

    • File upload
    • Vector store creation
    • Thread-based agent execution

Expected Behaviour

client.agents.files.upload_and_poll() should either:

  • Return a valid file object with .id as it previously did, or
  • Raise a descriptive deprecation/migration error pointing to the new API surface

A raw json.JSONDecodeError: Expecting value: line 1 column 1 (char 0) with binary bytes in the response is not an acceptable failure mode for a public SDK method.


Environment

Package Version
azure-ai-agents 1.1.0b4
azure-ai-projects 1.0.0b11
azure-ai-inference 1.0.0b9
azure-core 1.35.0
azure-identity 1.23.1
openai 1.84.0
Python 3.12
OS macOS
Auth DefaultAzureCredentialAzureCliCredential
Client azure.ai.projects.aio.AIProjectClient (async)

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.questionThe 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