Python message patterns

Here is a comprehensive list of exception message patterns the default grouping algorithm recognizes in python. For each pattern you will find:

  • Condition: circumstances under which we apply the pattern
  • Patterns: one or more regular expressions that we use to match against the exception message
  • Applied grouping: the fields we include when computing the fingerprint when the pattern matches

AttributeError

  • Condition:

    • language is python
    • root exception class is AttributeError
  • Patterns:

    ^'<object>' object has no attribute '<attribute>'$
    • object: (\w+)
    • attribute: (\w+)
  • Applied grouping:

    • Include object and attribute in the fingerprint

DoesNotExist

  • Condition:

    • language is python
    • root exception class is DoesNotExist
  • Patterns:

    ^<model> matching query does not exist\.$
    • model: (\w+)
  • Applied grouping:

    • Include model in the fingerprint

HTTPError

  • Condition:

    • language is python
    • root exception class is HTTPError
  • Patterns:

    ^<status_code> Client Error: <error> for url: <url>$
    • status_code: (4\d\d)
    • error: (.*)
    • url: (\S+)
    ^<status_code> Server Error: <error> for url: <url>$
    • status_code: (5\d\d)
    • error: (.*)
    • url: (\S+)
  • Applied grouping:

    • Include status_code in the fingerprint

IndexError

  • Condition:

    • language is python
    • root exception class is IndexError
  • Patterns:

    ^<iterable> index out of range$
    • iterable: (\w+)
  • Applied grouping:

    • Do not include any variables

NameError - (local) Name not defined

  • Condition:

    • language is python
    • root exception class is NameError
  • Patterns:

    ^name '<variable_name>' is not defined$
    • variable_name: (\S+)
  • Applied grouping:

    • Include variable_name in the fingerprint

NameError - Global name not defined

  • Condition:

    • language is python
    • root exception class is NameError
  • Patterns:

    ^global name '<variable_name>' is not defined$
    • variable_name: (\S+)
  • Applied grouping:

    • Include variable_name in the fingerprint

TypeError - No method defined

  • Condition:

    • language is python
    • root exception class is TypeError
  • Patterns:

    ^'<class_name>' object is not subscriptable$
    • class_name: (\S+)
    ^'<class_name>' object is not iterable$
    • class_name: (\S+)
    ^'<class_name>' object is not callable
    • class_name: (\S+)
    ^object of type '<class_name>' has no <method_name>$
    • class_name: (\S+)
    • method_name: (\S+)
  • Applied grouping:

    • Include class_name and method_name in the fingerprint

TypeError - Unsupported operator

  • Condition:

    • language is python
    • root exception class is TypeError
  • Patterns:

    ^unsupported operand type\(s\) for <operator>: '<lhs>' and '<rhs>'$
    • operator: (\S+)
    • lhs: (\S+)
    • rhs: (\S+)
    ^'<operator>' not supported between instances of '<lhs>' and '<rhs>'$
    • operator: (\S+)
    • lhs: (\S+)
    • rhs: (\S+)
  • Applied grouping:

    • Include lhs and rhs in the fingerprint

TypeError - Object is not JSON serializable

  • Condition:

    • language is python
    • root exception class is TypeError
  • Patterns:

    ^Object of type <class_name> is not JSON serializable$
    • class_name: (\S+)
  • Applied grouping:

    • Include class_name in the fingerprint