We discovered this late in the cycle, essentially when we detect that we need to discard the cache completely, we incorrectly leave some state behind.
The most common way you can run into this situation is when you copy the project from one location to another or there are two different casings across builds.
Removing the obj folder and triggering a new build should make the issue go away. Alternatively, removing duplicate assets using the following snippet
<Target Name="RemoveCachedDuplicates" AfterTargets="ResolveProjectStaticWebAssets">
<ItemGroup>
<_UniqueAssets Include="@(StaticWebAsset->Distinct())" />
<StaticWebAsset Remove="@(_UniqueAssets)" />
<StaticWebAsset Include="@(_UniqueAssets)" />
</ItemGroup>
</Target>