Unity-Technologies/UnityCsReference · error · Exception
More Assemblies in the list than delivered. Only filtering,
Error message
More Assemblies in the list than delivered. Only filtering, not adding extra assemblies
What it means
Thrown during the assembly-filtering phase of a build when an IFilterBuildAssemblies processor's OnFilterAssemblies returns an array longer than the one it received. The contract is strictly subtractive: processors may only remove assemblies, never add them. This guard catches processors that violate that invariant by returning more entries than they were given.
Source
Thrown at Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:1416
[RequiredByNativeCode]
internal static string[] FilterAssembliesIncludedInBuild(BuildOptions buildOptions, string[] assemblies)
{
if (processors.filterBuildAssembliesProcessor == null)
{
return assemblies;
}
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;View on GitHub (pinned to 225b0fbdb5)
Solutions
- Ensure OnFilterAssemblies only ever returns a subset (or the same set) of the assemblies it receives — never a superset.
- If you need to add assemblies, use a different mechanism such as IPreprocessBuildWithReport or asmdef references rather than the filter hook.
- Audit any installed packages/plugins that implement IFilterBuildAssemblies and disable or fix the offending one.
Example fix
// before
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
var list = new List<string>(assemblies);
list.Add("MyExtraAssembly.dll"); // WRONG — only filtering is allowed
return list.ToArray();
}
// after
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
// Only remove assemblies, never add
return assemblies.Where(a => !a.Contains("Test")).ToArray();
} Defensive patterns
Strategy: validation
Validate before calling
// Inside IFilterBuildAssemblies.OnFilterAssemblies:
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
int inputCount = assemblies.Length;
string[] filtered = DoMyFiltering(assemblies);
// Postcondition: result must not be larger than input
if (filtered.Length > inputCount)
throw new InvalidOperationException(
$"OnFilterAssemblies returned {filtered.Length} entries but received {inputCount}. Only removal is allowed.");
return filtered;
} Prevention
- Treat OnFilterAssemblies as strictly subtractive: only remove, never add.
- Add a postcondition assertion in your processor that the returned array length does not exceed the input.
- Use a different extension point (asmdef, Link XML) if you need to add or redirect assemblies.
When it happens
Trigger: An IFilterBuildAssemblies implementation whose OnFilterAssemblies returns an array with more elements than the input assemblies array — e.g., by concatenating additional assembly names or returning a superset.
Common situations: A custom build processor attempts to inject additional assemblies into the build via the filter hook instead of using the correct API, or a processor accidentally creates a new array that duplicates entries. Also occurs when a third-party plugin's IFilterBuildAssemblies implementation is buggy or incompatible with the Unity version.
Related errors
- New Assembly names are in the list. Only filtering are allow
- 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/f49bb5e15b3e244d.
Report an issue: GitHub.