CoplayDev/unity-mcp · error · ArgumentException
Input path '{inputPath}' is not a valid ADB folder
Error message
Input path '{inputPath}' is not a valid ADB folder What it means
Thrown when AssetDatabase.IsValidFolder returns false for one of the input paths in TypePreviewGeneratorBase.ValidateSettings. Each path is stripped of a trailing slash, then checked against the AssetDatabase (not the filesystem) — meaning the folder must be inside the Unity project and imported. A path that exists on disk but not in ADB still fails.
Source
Thrown at TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Previews/Scripts/Generators/Custom/TypeGenerators/TypePreviewGeneratorBase.cs:32
public TypeGeneratorSettings Settings { get; }
public abstract event Action<int, int> OnAssetProcessed;
public TypePreviewGeneratorBase(TypeGeneratorSettings settings)
{
Settings = settings;
}
public virtual void ValidateSettings()
{
if (Settings.InputPaths == null || Settings.InputPaths.Length == 0)
throw new ArgumentException("Input path cannot be null");
foreach (var path in Settings.InputPaths)
{
var inputPath = path.EndsWith("/") ? path.Remove(path.Length - 1) : path;
if (!AssetDatabase.IsValidFolder(inputPath))
throw new ArgumentException($"Input path '{inputPath}' is not a valid ADB folder");
}
if (string.IsNullOrEmpty(Settings.OutputPath))
throw new ArgumentException("Output path cannot be null");
}
public async Task<List<PreviewMetadata>> Generate()
{
var generatedPreviews = new List<PreviewMetadata>();
ValidateSettings();
var assets = CollectAssets();
assets = FilterIgnoredAssets(assets);
if (assets.Count() == 0)
return generatedPreviews;
return await GenerateImpl(assets);
View on GitHub (pinned to c21bf496bc)
Solutions
- Ensure each InputPath is a relative path inside the Assets/ folder (e.g., 'Assets/MyFolder').
- Verify the folder exists in the Project window (which reflects ADB state), not just in the file explorer.
- If the folder was recently created, trigger an AssetDatabase.Refresh() before validation.
- Normalize path separators and remove trailing slashes before passing paths to settings.
Example fix
// before
var settings = new TextureTypeGeneratorSettings { InputPaths = new[] { "/home/user/textures", "C:/Textures" }, ... };
// after
var settings = new TextureTypeGeneratorSettings { InputPaths = new[] { "Assets/Textures" }, ... }; Defensive patterns
Strategy: validation
Validate before calling
foreach (var path in settings.InputPaths)
{
var cleanPath = path.TrimEnd('/');
if (!AssetDatabase.IsValidFolder(cleanPath))
Debug.LogError($"'{cleanPath}' is not a valid AssetDatabase folder. Ensure it is inside the Assets/ directory.");
}
// Trigger refresh if folders may be stale
AssetDatabase.Refresh(); Type guard
static bool AreAllInputPathsValidADB(string[] paths)
=> paths != null && paths.Length > 0 && paths.All(p => AssetDatabase.IsValidFolder(p.TrimEnd('/'))); Try / catch
try
{
await generator.Generate();
}
catch (ArgumentException ex) when (ex.Message.Contains("not a valid ADB folder"))
{
Debug.LogError($"Invalid input folder: {ex.Message}. Use paths relative to the project (e.g., 'Assets/MyFolder').");
} Prevention
- Use only relative paths inside the Assets/ folder for InputPaths.
- Call AssetDatabase.Refresh() after creating new folders before preview generation.
- Validate folders through the Project window, not the filesystem explorer.
- Normalize path separators and remove trailing slashes.
When it happens
Trigger: Iterating Settings.InputPaths in ValidateSettings: for each path, a trailing slash is removed, then AssetDatabase.IsValidFolder(inputPath) returns false.
Common situations: Path points to a folder outside the Unity project (e.g., an absolute system path); folder was deleted or moved after being selected; folder exists on disk but hasn't been imported by Unity yet; path has a typo or uses backslashes on Windows; folder is inside the project but under a .gitignore'd or hidden directory.
Related errors
- Input path cannot be null
- Output path cannot be null
- Package Exporting failed: provided export paths are empty or
- Width should be larger than 0
- Height should be larger than 0
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/d2f05cd1994c72a7.
Report an issue: GitHub.