nopSolutions/nopCommerce · error · NopException
{e.Message}
Error message
{e.Message} What it means
In ArtificialIntelligenceService.CreateMetaTagsAsync, a try/catch wraps all AI calls (meta title, keywords, description generation). Any exception is logged via _logger.ErrorAsync then re-thrown as a new NopException(e.Message). This loses the original stack/inner detail (no innerException passed) but preserves the message text, so callers see the underlying AI error as a NopException.
Source
Thrown at src/Libraries/Nop.Services/ArtificialIntelligence/ArtificialIntelligenceService.cs:211
var metaDescriptionQueryFormat = string.IsNullOrEmpty(_artificialIntelligenceSettings.MetaDescriptionQuery)
? ArtificialIntelligenceDefaults.MetaDescriptionQuery
: _artificialIntelligenceSettings.MetaDescriptionQuery;
var metaDescriptionQuery = string.Format(metaDescriptionQueryFormat, title, text, currentLanguage.Name);
var result = await _httpClient.SendQueryAsync(metaDescriptionQuery);
metaDescription = result.Trim('"');
}
else
{
metaDescription = currentMetaDescription;
}
}
catch (Exception e)
{
var customer = await _workContext.GetCurrentCustomerAsync();
await _logger.ErrorAsync(e.Message, e, customer);
throw new NopException(e.Message);
}
return (metaTitle, metaKeywords, metaDescription);
}
/// <summary>
/// Create meta tags by artificial intelligence
/// </summary>
/// <param name="entity">The entity to which need to generate meta tags</param>
/// <param name="currentMetaTitle">Current entity meta title</param>
/// <param name="currentMetaKeywords">Current entity meta keywords</param>
/// <param name="currentMetaDescription">Current entity meta description</param>
/// <param name="languageId">Target language identifier</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the generated meta tags
/// </returns>
protected virtual async Task<(string metaTitle, string metaKeywords, string metaDescription)> CreateMetaTagsAsync<TEntity>(TEntity entity,View on GitHub (pinned to 64bdf2ff08)
Solutions
- Fix the underlying AI provider error (see SendQueryAsync NopException): verify API key, quota, network, RequestTimeout.
- Catch NopException at the calling layer and degrade gracefully (keep existing meta tags) rather than failing the whole entity save.
- Ensure the entity has non-empty title/text so ValidateTitleAndTextAsync does not throw before AI calls.
- Check the log (the original exception is recorded with full detail) to find root cause.
Example fix
// before
var (t, k, d) = await _aiService.CreateMetaTagsAsync(entity, languageId);
// after
try
{
var (t, k, d) = await _aiService.CreateMetaTagsAsync(entity, languageId);
}
catch (NopException)
{
// keep existing meta tags; AI generation is non-critical
} Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure entity has title/text in target language before calling meta generation // (delegates to ValidateTitleAndTextAsync which throws on empty)
Try / catch
try { var (t,k,d) = await _aiService.CreateMetaTagsAsync(entity, languageId); }
catch (NopException) { /* keep existing meta tags; AI generation is non-critical */ } Prevention
- Treat meta-tag generation as non-blocking; catch NopException and keep existing values.
- Ensure the entity has non-empty title/text so validation does not throw.
- Check the log for the original exception detail (it is recorded with stack).
When it happens
Trigger: Generating meta tags for a Product/Category/BlogPost/Manufacturer/Topic/Vendor when any of the inner SendQueryAsync calls fail (provider error, timeout) — the catch re-wraps it as NopException(e.Message).
Common situations: AI provider misconfiguration or outage during meta-tag generation; RequestTimeout too short; missing title/text passed forward after validation; transient network error to the AI endpoint.
Related errors
- ArtificialIntelligence.CreateProductFailed
- {httpResponse.ReasonPhrase}
- {titleRequiredLocale} (localized, formatted with languageNam
- {textRequiredLocale} (localized, formatted with languageName
- Email is not valid.
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/9506c91fdf88bd68.
Report an issue: GitHub.