{"record":{"id":"977395cb78837e16","repo":"SigNoz/signoz","slug":"errcodeauditexportfailed-977395","errorCode":"ErrCodeAuditExportFailed","errorMessage":"failed to marshal audit logs","messagePattern":"failed to marshal audit logs","errorType":"error_code","errorClass":null,"httpStatus":500,"severity":"error","filePath":"ee/auditor/otlphttpauditor/export.go","lineNumber":29,"sourceCode":"\t\"github.com/SigNoz/signoz/pkg/errors\"\n\t\"github.com/SigNoz/signoz/pkg/types/audittypes\"\n\tcollogspb \"go.opentelemetry.io/proto/otlp/collector/logs/v1\"\n\t\"google.golang.org/protobuf/proto\"\n\n\tspb \"google.golang.org/genproto/googleapis/rpc/status\"\n)\n\nconst (\n\tmaxHTTPResponseReadBytes int64  = 64 * 1024\n\tprotobufContentType      string = \"application/x-protobuf\"\n)\n\nfunc (provider *provider) export(ctx context.Context, events []audittypes.AuditEvent) error {\n\tlogs := audittypes.NewPLogsFromAuditEvents(events, \"signoz\", provider.build.Version(), \"signoz.audit\")\n\n\trequest, err := provider.marshaler.MarshalLogs(logs)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, errors.TypeInternal, auditor.ErrCodeAuditExportFailed, \"failed to marshal audit logs\")\n\t}\n\n\tif err := provider.send(ctx, request); err != nil {\n\t\tprovider.settings.Logger().ErrorContext(ctx, \"audit export failed\", errors.Attr(err), slog.Int(\"dropped_log_records\", len(events)))\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// Posts a protobuf-encoded OTLP request to the configured endpoint.\n// Retries are handled by the underlying heimdall HTTP client.\n// Ref: https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlphttpexporter/otlp.go\nfunc (provider *provider) send(ctx context.Context, body []byte) error {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, provider.config.OTLPHTTP.Endpoint.String(), bytes.NewReader(body))\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/ee/auditor/otlphttpauditor/export.go#L11-L47","documentation":"The OTLP-HTTP auditor failed to marshal audit events into OTLP logs via the configured marshaler before sending; wrapped with ErrCodeAuditExportFailed and classified as internal.","triggerScenarios":"provider.export() on audit events that produce a PLog the marshaler cannot serialize — typically a nil marshaler (misconfigured provider), or event payloads with data the OTLP proto marshaler rejects.","commonSituations":"Misconfigured otlphttp auditor provider wiring; version mismatch between signoz ee and the otel collector marshaler; corrupted/unexpected fields in AuditEvent structs from a partial upgrade.","solutions":["Check auditor provider config and initialization (marshaler must be set by the factory)","Ensure the signoz-ee binary version matches the configured otel libs (rebuild/redeploy whole image, not partial)","Inspect the AuditEvent payload for unsupported field types; sanitize custom event data","Report upstream with the underlying marshaler error if config is correct"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := auditor.Export(ctx, events); err != nil {\n\tif errors.Ast(err, auditor.ErrCodeAuditExportFailed) { slog.Error(\"audit export failed\", errors.Attr(err)); /* buffer/drop per policy, do not crash request path */ }\n}","preventionTips":["Pin consistent signoz-ee image versions across services","Add startup self-test that exports a no-op audit event","Monitor audit export failure counters"],"tags":["signoz","otlp","marshaling","auditor","internal"],"backgroundTag":"serialization-failure","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}