{"record":{"id":"886977a94aca9765","repo":"nopSolutions/nopCommerce","slug":"error-code-error-message-environment-newline","errorCode":null,"errorMessage":"{error.Code} - {error.Message}{Environment.NewLine}Debug ID: {error.DebugId}","messagePattern":"(.+?) - (.+?)(.+?)Debug ID: (.+?)","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Widgets.FacebookPixel/Services/FacebookPixelService.cs","lineNumber":589,"sourceCode":"        var conversionsApiConfigurations = configurations.Where(configuration => configuration.ConversionsApiEnabled).ToList();\n        var pixelConfigurations = configurations.Where(configuration => configuration.PixelScriptEnabled).ToList();\n        if (!conversionsApiConfigurations.Any() && !pixelConfigurations.Any())\n            return false;\n\n        var model = await prepareModel();\n\n        if (pixelConfigurations.Any())\n            await PrepareEventScriptAsync(model);\n\n        var logErrors = true; //set it to false to ignore Conversions API errors \n        foreach (var configuration in conversionsApiConfigurations)\n        {\n            await HandleFunctionAsync(async () =>\n            {\n                var response = await _facebookConversionsHttpClient.SendEventAsync(configuration, model);\n                var error = JsonConvert.DeserializeAnonymousType(response, new { Error = new ApiError() })?.Error;\n                if (!string.IsNullOrEmpty(error?.Message))\n                    throw new NopException($\"{error.Code} - {error.Message}{Environment.NewLine}Debug ID: {error.DebugId}\");\n\n                return true;\n            }, logErrors);\n        }\n\n        return true;\n    }\n\n    /// <summary>\n    /// Prepare user data for conversions api\n    /// </summary>\n    /// <returns>\n    /// <param name=\"customer\">Customer</param>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the user data\n    /// </returns>\n    protected async Task<ConversionsEventUserData> PrepareUserDataAsync(Customer customer = null)\n    {","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Widgets.FacebookPixel/Services/FacebookPixelService.cs#L571-L607","documentation":"Thrown by the Conversions API integration when the Facebook Conversions API response, deserialized anonymously, contains a non-empty error.Message. The message format is '{Code} - {Message}\\nDebug ID: {DebugId}', where DebugId is Facebook's correlation token for support.","triggerScenarios":"SendEventAsync returns a response whose JSON has an Error object with Code/Message — typical causes: invalid access token, missing/pixel-id mismatch, event payload failing validation, rate limiting, duplicate event_id.","commonSituations":"Access token expired or revoked; Pixel ID mismatch between configuration and token's owned pixels; missing required user data hashing; duplicated request event_id causing deduplication error; graph API rate limit.","solutions":["Capture the DebugId from the exception and use it in the Facebook Business support / Graph API explorer to identify the exact failure.","Verify the access token is valid and has access to the configured Pixel (re-issue via Facebook Login).","Validate the ConversionsEvent payload (required fields, correctly hashed user data, unique event_id) before sending."],"exampleFix":"// before\nif (!string.IsNullOrEmpty(error?.Message))\n    throw new NopException($\"{error.Code} - {error.Message}{Environment.NewLine}Debug ID: {error.DebugId}\");\n\n// after — keep the error but include DebugId programmatically for retries\nthrow new ConversionsApiException(error.Code, error.Message, error.DebugId);\n// caller:\n// if (ex.Code == \"rate_limit\") await Task.Delay(backoff); retry once;","handlingStrategy":"retry","validationCode":"if (string.IsNullOrWhiteSpace(configuration.AccessToken) || configuration.PixelId <= 0)\n    throw new InvalidOperationException(\"Facebook Pixel configuration incomplete\");","typeGuard":"static bool IsConfigComplete(FacebookPixelConfiguration c) => !string.IsNullOrWhiteSpace(c?.AccessToken) && c.PixelId > 0;","tryCatchPattern":"try { await SendEventAsync(configuration, model); }\ncatch (NopException ex) when (ex.Message.Contains(\"Debug ID\"))\n{ _logger.LogError(\"Conversions API error DebugId={DebugId}\", ExtractDebugId(ex.Message));\n  if (IsTransient(ex.Message)) await RetryAsync(() => SendEventAsync(configuration, model)); }","preventionTips":["Keep the access token fresh and verify it owns the configured Pixel.","Hash user data and include a unique event_id to avoid deduplication errors.","Capture and persist the DebugId for Facebook support escalation."],"tags":["facebook-pixel","conversions-api","api-error","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}