Automatic error assignment

Learn how to implement a rules based approach to automatically assign an error to a collaborator or team

Automatic Error Assignment is available for Enterprise plans only.

Triaging errors can be a repetitive process and often follows the same decision-making process, for example assigning all errors that originate from files in the src/components/cart directory to the “Cart Team” or an individual collaborator. BugSnag allows you to create rules to automate this process.

How to create a rule

To get started with automatic error assignment go to Project settings > Automatic error assignment.

You can configure a rule to match errors in the following ways:

  • Code
    • File path
    • Method
  • Default metadata
  • Custom metadata

Code

Code rules use glob pattern matching to compare your rule against the stacktrace. You can reference the Linux documentation for more information on glob patterns.

Code rules can match errors using either:

  • Any frame, where we will look sequentially through all frames in the stack trace, including nested/caused-by exceptions - the error will be assigned the first time a match is found
  • The top frame, which will use the top in-project frame from the stack trace for matching (if there is no in-project code, we will simply use the first frame in the stack trace)

Code matches using file path

This option can be used to assign an error based on the source file’s name or directory.

code location using glob pattern

Code matches using method

Method rules can be used to assign errors based on the frame’s fully qualified method name, including the class and package/namespace. This should be used where the source file path is not available in stack traces - for example exceptions in Android (Java and Kotlin), Java server and Unity (C#) projects.

For example - if you have a method saveBasket belonging to the OrderSummary class in the com.example.orders package, the fully qualified method name would appear in BugSnag as com.example.orders.OrderSummary.saveBasket. In this case you may wish to setup an assignment rule to assign the error to your ‘Orders’ team using the glob pattern com.example.orders.**. This would also match any other errors originating from the com.example.orders package or its subpackages.

code location using glob pattern

Default metadata

This is a selection of fields that are sent by default with an error, for example context, user.id etc. Note that this does not include custom metadata.

default fields

Enter the value you wish to match to the field. Value matching is exact but case insensitive.

context value

Custom metadata

To automatically assign errors based on custom metadata you will need to use dot notation prepended with metaData - so if you have a tab in the error details page named owners and that tab had the property owner you would reference this using metaData.owners.owner.

context value

Enter the value you wish to match to the field. Value matching is exact but case insensitive.

Automatic assignment rules are checked for matches the first time an error occurs; the error will not be reassigned when subsequent events are received, even if you change the collaborator or team to which the rule is assigned.

Managing precedence

Order is important. Rules are applied in order until a match is made. Drag and drop rules to change the order.

Drag and drop to change the order of rules

In general, more specific rules should be higher up the list. For example you might have /src/components/cart/cart.tsx towards the top, then **/*.tsx lower down if you wanted a fallback catch-all rule for .tsx files.

Bulk updating rules

For larger projects, you may wish to update your automatic error assignment rules programatically - for example to keep the rules in sync with a CODEOWNERS.md file.

The BugSnag data access API has an endpoint which you can use to bulk update all of your error assignment rules.