stride3d/stride · error · InvalidOperationException
CommandList updating the staging resource has not been…
Error message
CommandList updating the staging resource has not been submitted
What it means
Before the CPU waits on a fence for a staging resource, Map verifies ownership of the last update. If another CommandList is currently updating the resource and that list has not been submitted (flushed), the code cannot safely wait, so it throws InvalidOperationException('CommandList updating the staging resource has not been submitted').
Solutions
- Submit/Flush the command list that performed the Update (its.UpdatingCommandList flush) before mapping the resource from another list.
- Map the staging resource from the same command list that updated it, or after that list has been submitted and the fence signaled.
- Reorder code so Update and subsequent Map happen on the same command list in one submission.
- Ensure the engine lifecycle sets UpdatingCommandList back to null after submission if you manage resources manually.
Example fix
// before secondaryCommandList.Update(stagingTexture, data); commandList.Map(stagingTexture, MapMode.Read, 0); // throws: secondary not submitted // after secondaryCommandList.Update(stagingTexture, data); secondaryCommandList.Flush(); commandList.Map(stagingTexture, MapMode.Read, 0);
Defensive patterns
Strategy: try-catch
Validate before calling
var updater = resource.UpdatingCommandList;
if (updater is not null && updater != commandList)
updater.Flush(); // submit before mapping from another list Try / catch
try { commandList.Map(stagingResource, MapMode.Read, 0); }
catch (InvalidOperationException ex) when (ex.Message.Contains("has not been submitted"))
{ resource.UpdatingCommandList?.Flush(); /* retry */ } Prevention
- Submit the command list that updated a staging resource before mapping it elsewhere.
- Keep Update and Map of a staging resource on the same command list when possible.
- Avoid interleaving staging-resource updates across multiple command lists within a frame.
When it happens
Trigger: Mapping a staging resource from one CommandList while resource.UpdatingCommandList points to a different, unsubmitted CommandList — i.e. data was recorded for upload on another command list but Flush/Submit hasn't been called on it.
Common situations: Recording updates on a background/secondary command list, then mapping the resource from the main list before submitting; interleaving Update on one list with Map on another within the same frame.
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
- Invalid state for
- ArgumentNullException (targetProfiles)
- Cannot copy data between Buffers and Textures.
- Cannot copy data between GraphicsResources of types
- Copy region from staging texture is not supported yet
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/73971e72305f6c47.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D12/CommandList.Direct3D12.cs:2286
{
// Need to wait?
if (
// used in command list which hasn't be submitted yet? (only valid if our own, checked later)
resource.UpdatingCommandList is not null
// updated in a previous command list which hasn't be finished yet
|| (resource.CommandListFenceValue is not null && !GraphicsDevice.CommandListFence.IsFenceCompleteInternal(resource.CommandListFenceValue.Value)))
{
if (doNotWait)
{
return new MappedResource(resource, subResourceIndex, dataBox: default);
}
if (resource.UpdatingCommandList == this)
// Need to flush? (check if part of current Command List)
// resource.CommandListFenceValue should be set after
FlushInternal(wait: false);
else if (resource.UpdatingCommandList is not null)
throw new InvalidOperationException("CommandList updating the staging resource has not been submitted");
if (resource.CommandListFenceValue is null)
throw new InvalidOperationException($"Invalid state for {resource.CommandListFenceValue}");
GraphicsDevice.CommandListFence.WaitForFenceCPUInternal(resource.CommandListFenceValue.Value);
// We're now up to date, remove command list fence value (if any)
resource.CommandListFenceValue = null;
}
}
// Also make sure all copy queues are done
// (important for all cases, since it uploads initial data and also set resource barrier)
if (resource.CopyFenceValue.HasValue)
{
GraphicsDevice.CopyFence.WaitForFenceCPUInternal(resource.CopyFenceValue.Value);
resource.CopyFenceValue = null;
}View on GitHub (pinned to 96fad776d2)