OrchardCMS/OrchardCore · error · InvalidOperationException
Both the index-name and index full-name must be set.
Error message
Both the index-name and index full-name must be set.
What it means
DefaultIndexProfileHandler.CreatingAsync calls SetIndexFullName to derive IndexName and IndexFullName from the profile, then validates both are non-empty. If the handler could not derive them, it throws InvalidOperationException to stop creation of an unusable index profile.
Solutions
- Ensure the profile's provider sets IndexName before creation completes (implement provider-specific naming defaults).
- Pass a non-empty name when creating the profile via IIndexProfileManager.NewAsync(provider, name).
- Fix recipe/import JSON so the index profile 'Name' field is present.
Example fix
// before
var profile = await indexProfileManager.NewAsync("Lucene");
await indexProfileManager.CreateAsync(profile); // IndexName empty
// after
var profile = await indexProfileManager.NewAsync("Lucene", "MySearchIndex");
await indexProfileManager.CreateAsync(profile); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(profile.IndexName) || string.IsNullOrEmpty(profile.IndexFullName))
throw new ArgumentException("IndexName and IndexFullName must be set before creating the profile."); Try / catch
try { await manager.CreateAsync(profile); }
catch (InvalidOperationException ex) when (ex.Message.Contains("index-name")) { /* prompt user for a name */ } Prevention
- Always supply a name via NewAsync(provider, name)
- Implement provider default naming for custom profile types
- Validate recipe JSON index profile entries during authoring
When it happens
Trigger: Creating an IndexProfile (via IIndexProfileManager.CreateAsync or the admin UI) whose descriptor/type does not populate IndexName, so SetIndexFullName cannot compute IndexName/IndexFullName.
Common situations: Custom index profile types (e.g. new search providers) missing the naming setup; recipes or import code creating profiles with empty names; version changes where provider defaults were dropped.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- The 'Default' tenant can't be removed.
- The index does not have a key field.
- ,
- Content part name must start with a letter
- Content part name contains invalid characters
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/731d215d63055040.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore/OrchardCore.Indexing.Core/Handlers/DefaultIndexProfileHandler.cs:132
{
context.Result.Fail(new ValidationResult(S["The index full name is required. Unable to find a index name provider that with the provider name '{0}'.", context.Model.ProviderName, context.Model.Type], [nameof(IndexProfile.Type)]));
}
else
{
// Set the full name of the index.
context.Model.IndexFullName = nameProvider.GetFullIndexName(context.Model.IndexName);
}
}
}
}
public override Task CreatingAsync(CreatingContext<IndexProfile> context)
{
SetIndexFullName(context.Model);
if (string.IsNullOrEmpty(context.Model.IndexName) || string.IsNullOrEmpty(context.Model.IndexFullName))
{
throw new InvalidOperationException("Both the index-name and index full-name must be set.");
}
return Task.CompletedTask;
}
public override Task InitializedAsync(InitializedContext<IndexProfile> context)
{
context.Model.CreatedUtc = _clock.UtcNow;
var user = _httpContextAccessor.HttpContext?.User;
if (user != null)
{
context.Model.OwnerId = user.FindFirstValue(ClaimTypes.NameIdentifier);
context.Model.Author = user.Identity.Name;
}
return Task.CompletedTask;
}View on GitHub (pinned to 4306c0717f)