def is_pattern_error(exception: TypeError) -> bool:
    """Detect whether the input exception was caused by invalid type passed to `re.search`."""
    # This is intentionally simplistic and do not involve any traceback analysis
    return str(exception) == "expected string or bytes-like object"