question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] <unlabeled event>

See original GitHub issue

i’ve seen a few discussions regarding <unlabeled event> but the following body seems fine by the looks of it, doesn’t it ?

We are seeing this mostly on the following Client Setup: IE 11.0 Windows (mostly 7)

{
  "name": "exception",
  "value": {
    "values": [
      {
        "stacktrace": {
          "frames": [
            {
              "function": "?",
              "filename": "https://mysvg.de/",
              "in_app": true
            }
          ]
        },
        "value": {}
      }
    ]
  }
}

Our Angular 4 ErrorHandler Class:

export class GlobalErrorHandler implements ErrorHandler {
    static isErrorOrErrorEvent (wat) {
      return Object.prototype.toString.call(wat) === '[object Error]' || Object.prototype.toString.call(wat) === '[object ErrorEvent]';
    }
    constructor(private injector: Injector) {}

    handleError(err) {
      const error = err.originalError || err;

      if (GlobalErrorHandler.isErrorOrErrorEvent(error)) {
        Raven.captureException(error);
      } else {
        Raven.captureMessage(error.error || error);
      }
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:45 (20 by maintainers)

github_iconTop GitHub Comments

13reactions
shcallawaycommented, May 10, 2018

I got around to digging deeper into this, and I think I found the source of the problem.

Where does “unlabeled event” come from?

<unlabeled event> is not something that users are passing, nor is it something that Raven applies. Where does it come from?

The answer is the Sentry server:

    def get_metadata(self):
        # See GH-3248
        message_interface = self.data.get(
            'sentry.interfaces.Message', {
                'message': self.data.get('message', ''),
            }
        )
        message = strip(message_interface.get('formatted', message_interface['message']))
        if not message:
            title = '<unlabeled event>'
        else:
            title = truncatechars(message.splitlines()[0], 100)
        return {
            'title': title,
        }

https://github.com/getsentry/sentry/blob/96bc1c63df5ec73fe12c136ada11561bf52f1ec9/src/sentry/eventtypes/base.py#L38

When handling a DefaultEvent object, Sentry attempts to get the “sentry.interfaces.Message” property (unsuccessfully) and falls back to the default value: { 'message': self.data.get('message', '') }

Which in turn evaluates to: { ‘message': ‘’ }

So message_interface is assigned to this object, and on line 36, message is assigned to message_interface[‘message’] — an empty string!

In the conditional on line 37, the empty string evaluates to false and title is assigned to our old friend, <unlabeled event>.

TL;DR — The DefaultEvent is lacking both of the following properties: sentry.interfaces.Message and message. So Sentry uses a stand-in value as the title: <unlabeled event>

There’s an error while processing this event. Why?

All unlabeled event errors appear alongside the same message: “There was 1 error encountered while processing this event”.

image

I believe this is the line responsible for adding the processing error.

The code appears to be casting each property (environment, breadcrumbs, exception, etc.) to a specific format. When the cast fails, it adds a processing error.

What happens next is highly interesting: The raw ‘message’ is coerced to the Sentry message interface:

        # raw 'message' is coerced to the Message interface, as its used for pure index of
        # searchable strings. If both a raw 'message' and a Message interface exist, try and
        # add the former as the 'formatted' attribute of the latter.
        # See GH-3248
        msg_str = data.pop('message', None)
        if msg_str:
            msg_if = data.setdefault('sentry.interfaces.Message', {'message': msg_str})
            if msg_if.get('message') != msg_str:
                msg_if.setdefault('formatted', msg_str)

If the message property is missing, it defaults to None, and msg_str becomes falsy. If msg_str is falsy, the sentry.interfaces.Message and formatted properties are never assigned to msg_if. As we saw at the beginning of this post, these properties are necessary to prevent title from being assigned to <unlabeled event>.

Hypothesis

Raven is sending a bad message object to the Sentry server. Specifically, it is missing the message property — or the message property is a falsy value, such as an empty string.

My guess is that somewhere in the captureException function (here), captureMessage is being passed an empty string for the msg param. Unfortunately, I can’t figure out which if statement the error falls into because don’t have access to the original error object —and I don’t know how to reproduce it.

Solution

We need to make sure to call captureMessage with a good msg param. In other words, we should not be passing it an empty string.

captureMessage is being called within captureException, so it looks like there’s an error type (or object shape) that we are not accounting for there.

5reactions
kamilogorekcommented, Jun 20, 2018

Released as 3.26.3. Would appreciate a feedback with everyone’s findings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why all my events are 'unlabeled event' and have Discarded ...
In my account I get only one issue: unlabeled event, and all of them have this error notice: There were 2 errors encountered...
Read more >
1417107 - Switch to add "(unlabeled)" instead of "(labeled)" in ...
We really don't want to build dynamic strings for the default case. It is also a good idea to move this out of...
Read more >
Why does an epic link show up as unlabeled?
Appears to be a platform bug, maybe because the input title was too long, it didn't create a Title in the Epic? It...
Read more >
Labeled and Unlabeled Together on one BGP Neighbor on ...
On Cisco IOS ® XR, the support to have both unlabeled and labeled on one BGP session was done in 6.2.1. ... Error...
Read more >
Detecting Errors and Estimating Accuracy on Unlabeled Data ...
of unlabeled test inputs; (2) error detection, which aims to identify mis-classified ... 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found