OrchardCMS/OrchardCore · error · ValidationException
,
Error message
,
What it means
ImportAsync validates each imported content item version; when validation fails, all errors are logged and rethrown as a ValidationException whose message is all errors joined with ', '. The bracketed 'message' here is that join separator — the actual message contains the validation error texts.
Solutions
- Inspect the joined ValidationException message and the log entry for the specific errors
- Ensure target site has the required features/content definitions enabled before import
- Fix the source JSON (required fields, valid types) and re-run the import
- Import in dependency order (types/parts before content items)
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
bool hasDefinition = await cm.GetContentDefinitionManager().GetTypeDefinition(item.ContentType) is not null;
Try / catch
try { await cm.ImportAsync(items, results); } catch (ValidationException ex) { foreach (var e in ex.Errors) { /* surface per-field message */ } } Prevention
- Enable required features before importing
- Match source/target Orchard versions
- Import definitions before content
- Validate imported JSON against target schema
When it happens
Trigger: Calling ImportAsync with a content item that fails handler validation (e.g., missing required parts, invalid values), producing one or more errors in result.Errors.
Common situations: Importing recipes/JSON exported from a different site version; missing content type/field definitions on the target site; duplicate ContentItemVersionIds in the import batch.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- The 'Default' tenant can't be removed.
- Content part name must start with a letter
- Content part name contains invalid characters
- Content field name must start with a letter
- Content field name contains invalid characters
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/3e20ce20558489da.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore/OrchardCore.ContentManagement/DefaultContentManager.cs:745
}
if (originalVersion == null)
{
// The version does not exist in the current database.
var context = new ImportContentContext(importingItem);
await Handlers.InvokeAsync((handler, context) => handler.ImportingAsync(context), context, _logger);
var evictionVersions = versionsThatMaybeEvicted.Where(x => string.Equals(x.ContentItemId, importingItem.ContentItemId, StringComparison.OrdinalIgnoreCase));
var result = await CreateContentItemVersionAsync(importingItem, evictionVersions);
if (!result.Succeeded)
{
if (_logger.IsEnabled(LogLevel.Error))
{
_logger.LogError("Error importing content item version id '{ContentItemVersionId}' : '{Errors}'", importingItem?.ContentItemVersionId, string.Join(", ", result.Errors));
}
throw new ValidationException(string.Join(", ", result.Errors));
}
// Imported handlers will only be fired if the validation has been successful.
// Consumers should implement validated handlers to alter the success of that operation.
await ReversedHandlers.InvokeAsync((handler, context) => handler.ImportedAsync(context), context, _logger);
importedContentItems.Add(importingItem);
}
else
{
// The version exists in the database.
// It is important to only import changed items.
// We compare the two versions and skip importing it if they are the same.
// We do this to prevent unnecessary sql updates, and because UpdateContentItemVersionAsync
// may remove drafts of updated items.
// This is necessary because an imported item maybe set to latest, and published.
// In this case, the draft item in the system, must be removed, or there will be two drafts.
// The draft item should be removed, because it would now be orphaned, as the imported published itemView on GitHub (pinned to 4306c0717f)