microsoft/aspire · error · InvalidOperationException

Interaction ' ' is not accepting file uploads.

Error message

Interaction '{interactionId}' is not accepting file uploads.

What it means

InteractionFileUploadStore.CreateEntry registers a temp file for a file upload tied to a dashboard interaction. If the interaction id is not present in the store (no active interaction accepting uploads), an InvalidOperationException is thrown. Uploads are only valid while their interaction exists and is in progress.

Solutions

  1. Ensure the interaction is still open (InProgress) before uploading; if it completed, restart the interaction and upload again.
  2. Use the exact interactionId returned by the interaction API — do not fabricate ids.
  3. Handle the failure client-side: abort the upload and re-create the interaction/file selection.
  4. Check timing in automation: wait for the interaction to be active before starting the upload stream.

Example fix

// before
var (fileId, path) = store.CreateEntry(name, staleInteractionId, input); // throws if the interaction is gone
// after
if (!store.TryGetInteraction(staleInteractionId, out var interaction) || interaction.State != FileInteractionState.InProgress)
{
    interactionId = await promptForNewInteractionAsync(); // recreate the interaction, then upload
}
var (fileId, path) = store.CreateEntry(name, interactionId, input);
Defensive patterns

Strategy: try-catch

Validate before calling

// Before uploading, confirm the interaction is still active via the interaction API and keep the returned interactionId.

Try / catch

try { await uploadTask; } catch (InvalidOperationException ex) when (ex.Message.Contains("not accepting file uploads")) { logger.LogWarning("Interaction {Id} closed during upload; restarting interaction and retrying.", interactionId); interactionId = await recreateInteractionAsync(); }

Prevention

When it happens

Trigger: Calling CreateEntry (via the UploadFile RPC) with an interactionId that was never registered, or whose interaction has already completed/failed and been removed from the store.

Common situations: User closes or submits the interaction while an upload is still streaming; a stale dashboard session retries an upload after the interaction ended; a custom client invents an interaction id.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/a678ddee0ce6eaec. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting/Dashboard/InteractionFileUploadStore.cs:47

    /// <summary>
    /// Registers an interaction and the file inputs that can own uploaded files.
    /// </summary>
    public void StartInteraction(int interactionId, IReadOnlyList<(string InputName, int MaxFileCount)> fileInputs)
    {
        if (_interactions.TryAdd(interactionId, new FileInteraction(fileInputs)))
        {
            _logger.LogDebug("Started tracking file uploads for interaction {InteractionId}.", interactionId);
        }
    }

    /// <summary>
    /// Creates a new temp file path and returns the file ID and path.
    /// </summary>
    public (string FileId, string FilePath) CreateEntry(string originalFileName, int interactionId, string inputName)
    {
        if (!_interactions.TryGetValue(interactionId, out var interaction))
        {
            throw new InvalidOperationException($"Interaction '{interactionId}' is not accepting file uploads.");
        }

        lock (interaction)
        {
            if (interaction.State != FileInteractionState.InProgress)
            {
                throw new InvalidOperationException($"Interaction '{interactionId}' is not accepting file uploads.");
            }

            if (!interaction.FileInputLimits.TryGetValue(inputName, out var maxFileCount))
            {
                throw new InvalidOperationException($"Interaction '{interactionId}' is not accepting file uploads for input '{inputName}'.");
            }

            // Each client submits one file selection per input during an interaction. Multi-file selections upload
            // their files sequentially as part of that single selection, so every upload counts toward this limit.
            // Count uploads in progress as reserved slots so concurrent requests cannot exceed the input's limit.
            var fileCount = interaction.Files.Values.Count(entry => string.Equals(entry.InputName, inputName, StringComparisons.InteractionInputName));

View on GitHub (pinned to 25830f84bd)