Unity-Technologies/UnityCsReference · error · Exception
New Assembly names are in the list. Only filtering are allow
Error message
New Assembly names are in the list. Only filtering are allowed
What it means
Thrown after the assembly-filtering phase when the final filtered list contains assembly names that were not in the original startAssemblies set. Even if the count did not increase (e.g., an equal-length array with swapped names), introducing names absent from the original set violates the subtractive contract of IFilterBuildAssemblies.
Source
Thrown at Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:1422
}
string[] startAssemblies = assemblies;
string[] filteredAssemblies = assemblies;
foreach (var filteredAssembly in processors.filterBuildAssembliesProcessor)
{
using var _ = new ScopeTraceProfileBlock($"{filteredAssembly.GetType().Name}.OnFilterAssemblies");
int assemblyCount = filteredAssemblies.Length;
filteredAssemblies = filteredAssembly.OnFilterAssemblies(buildOptions, filteredAssemblies);
if (filteredAssemblies.Length > assemblyCount)
{
throw new Exception("More Assemblies in the list than delivered. Only filtering, not adding extra assemblies");
}
}
if (!Array.TrueForAll(filteredAssemblies, x => startAssemblies.Contains(x)))
{
throw new Exception("New Assembly names are in the list. Only filtering are allowed");
}
return filteredAssemblies;
}
[RequiredByNativeCode]
internal static void CleanupBuildCallbacks()
{
processors.buildTargetProcessors = null;
processors.buildPlayerProcessors = null;
processors.buildPreprocessors = null;
processors.buildPostprocessors = null;
processors.sceneProcessors = null;
processors.buildPreprocessorsWithReport = null;
processors.buildPreprocessorsWithContext = null;
processors.buildPostprocessorsWithReport = null;
processors.buildPostprocessorsWithContext = null;
processors.sceneProcessorsWithReport = null;View on GitHub (pinned to 225b0fbdb5)
Solutions
- Ensure OnFilterAssemblies only returns elements that are a strict subset of the input assemblies array.
- If you need to rename or redirect assemblies, use Assembly Definition references or Link XML instead of the filter hook.
- Log the returned array against the input array in your processor to identify which entry was introduced.
Example fix
// before
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
var list = new List<string>(assemblies);
list.Remove("OldName.dll");
list.Add("NewName.dll"); // WRONG — new name not in original set
return list.ToArray();
}
// after
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
// Only remove entries; never substitute
return assemblies.Where(a => a != "OldName.dll").ToArray();
} Defensive patterns
Strategy: validation
Validate before calling
// Inside IFilterBuildAssemblies.OnFilterAssemblies:
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
var inputSet = new HashSet<string>(assemblies);
string[] filtered = DoMyFiltering(assemblies);
// Postcondition: every returned entry must have been in the input
foreach (string entry in filtered)
{
if (!inputSet.Contains(entry))
throw new InvalidOperationException(
$"OnFilterAssemblies introduced '{entry}' which was not in the input set.");
}
return filtered;
} Prevention
- Never rename, substitute, or introduce assembly names in OnFilterAssemblies.
- Add a postcondition assertion that checks the returned set is a subset of the input.
- Cache the input assemblies in a HashSet for O(1) membership checks during validation.
When it happens
Trigger: An IFilterBuildAssemblies implementation returns an array containing assembly name strings that do not appear in the input — e.g., replacing or renaming entries rather than only removing them.
Common situations: A build processor that renames assemblies or substitutes one assembly name for another, a processor that returns a cached array from a prior build with different inputs, or a third-party plugin that rewrites the assembly list instead of filtering it.
Related errors
- More Assemblies in the list than delivered. Only filtering,
- Scene path "{0}" contains invalid directory separators.
- The build target does not support build appending.
- The build cannot be appended.
- Non-development build cannot allow debugging. Either add the
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/92d0905eabea61c7.
Report an issue: GitHub.