[GH-ISSUE #1298] viewing some scripts throws error #806

Closed
opened 2026-03-02 02:19:10 +03:00 by kerem · 0 comments
Owner

Originally created by @bbrendon on GitHub (Sep 27, 2022).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1298

Server Info (please complete the following information):

  • OS: Deb 11
  • Browser: Brave
  • RMM Version : 15.0

Installation Method: ] Standard

Describe the bug
I sent a video to whi1e. GUI throws 500 error.
I think this might be related to using script snippets? I also had a problem with script snippets about a month ago that I never reported in github. PM'ed wh1te about it. I think the fix was to delete comments from the top of the script snip that started with # . May be related to this?

Additional context
Add any other context about the problem here.

[27/Sep/2022 18:07:58] ERROR [django.request:241] Internal Server Error: /api/v3/192/kJovGmkAepFLSbmGqYsoSdGDPBlRYasTfZnBfOEa/taskrunner/
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/sre_parse.py", line 1051, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\w'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
    return self.dispatch(request, *args, **kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/rmm/api/tacticalrmm/apiv3/views.py", line 330, in get
    return Response(TaskGOGetSerializer(task, context={"agent": agent}).data)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 555, in data
    ret = super().data
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data
    self._data = self.to_representation(self.instance)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/fields.py", line 1838, in to_representation
    return method(value)
  File "/rmm/api/tacticalrmm/autotasks/serializers.py", line 236, in get_task_actions
    "code": script.code,
  File "/rmm/api/tacticalrmm/scripts/models.py", line 54, in code
    return self.replace_with_snippets(self.code_no_snippets)
  File "/rmm/api/tacticalrmm/scripts/models.py", line 69, in replace_with_snippets
    replaced_code = re.sub(snippet.group(), value, replaced_code)
  File "/usr/local/lib/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/local/lib/python3.10/re.py", line 326, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/local/lib/python3.10/re.py", line 317, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/local/lib/python3.10/sre_parse.py", line 1054, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \w at position 177 (line 11, column 24)
[27/Sep/2022 18:09:27] ERROR [django.request:241] Internal Server Error: /api/v3/WISyholVIzmwykYsBraCmppmJeKGOANFNLkdClIq/checkrunner/
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/sre_parse.py", line 1051, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\e'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
    return self.dispatch(request, *args, **kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/rmm/api/tacticalrmm/apiv3/views.py", line 269, in get
    ).data,
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 768, in data
    ret = super().data
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data
    self._data = self.to_representation(self.instance)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 686, in to_representation
    return [
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 687, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/fields.py", line 1838, in to_representation
    return method(value)
  File "/rmm/api/tacticalrmm/checks/serializers.py", line 167, in get_script_args
    return Script.parse_script_args(
  File "/rmm/api/tacticalrmm/scripts/models.py", line 213, in parse_script_args
    temp_args.append(re.sub("\\{\\{.*\\}\\}", value, arg))
  File "/usr/local/lib/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/local/lib/python3.10/re.py", line 326, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/local/lib/python3.10/re.py", line 317, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/local/lib/python3.10/sre_parse.py", line 1054, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \e at position 6
[27/Sep/2022 18:11:27] ERROR [django.request:241] Internal Server Error: /api/v3/WISyholVIzmwykYsBraCmppmJeKGOANFNLkdClIq/checkrunner/
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/sre_parse.py", line 1051, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\e'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
    return self.dispatch(request, *args, **kwargs)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/rmm/api/tacticalrmm/apiv3/views.py", line 269, in get
    ).data,
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 768, in data
    ret = super().data
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data
    self._data = self.to_representation(self.instance)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 686, in to_representation
    return [
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 687, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/fields.py", line 1838, in to_representation
    return method(value)
  File "/rmm/api/tacticalrmm/checks/serializers.py", line 167, in get_script_args
    return Script.parse_script_args(
  File "/rmm/api/tacticalrmm/scripts/models.py", line 213, in parse_script_args
    temp_args.append(re.sub("\\{\\{.*\\}\\}", value, arg))
  File "/usr/local/lib/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/local/lib/python3.10/re.py", line 326, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/local/lib/python3.10/re.py", line 317, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/local/lib/python3.10/sre_parse.py", line 1054, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \e at position 6

Originally created by @bbrendon on GitHub (Sep 27, 2022). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1298 **Server Info (please complete the following information):** - OS: Deb 11 - Browser: Brave - RMM Version : 15.0 **Installation Method:** ] Standard **Describe the bug** I sent a video to whi1e. GUI throws 500 error. I think this might be related to using script snippets? I also had a problem with script snippets about a month ago that I never reported in github. PM'ed wh1te about it. I think the fix was to delete comments from the top of the script snip that started with `#` . May be related to this? **Additional context** Add any other context about the problem here. ``` [27/Sep/2022 18:07:58] ERROR [django.request:241] Internal Server Error: /api/v3/192/kJovGmkAepFLSbmGqYsoSdGDPBlRYasTfZnBfOEa/taskrunner/ Traceback (most recent call last): File "/usr/local/lib/python3.10/sre_parse.py", line 1051, in parse_template this = chr(ESCAPES[this][1]) KeyError: '\\w' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/rmm/api/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/rmm/api/env/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view return self.dispatch(request, *args, **kwargs) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/rmm/api/tacticalrmm/apiv3/views.py", line 330, in get return Response(TaskGOGetSerializer(task, context={"agent": agent}).data) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 555, in data ret = super().data File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data self._data = self.to_representation(self.instance) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation ret[field.field_name] = field.to_representation(attribute) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/fields.py", line 1838, in to_representation return method(value) File "/rmm/api/tacticalrmm/autotasks/serializers.py", line 236, in get_task_actions "code": script.code, File "/rmm/api/tacticalrmm/scripts/models.py", line 54, in code return self.replace_with_snippets(self.code_no_snippets) File "/rmm/api/tacticalrmm/scripts/models.py", line 69, in replace_with_snippets replaced_code = re.sub(snippet.group(), value, replaced_code) File "/usr/local/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) File "/usr/local/lib/python3.10/re.py", line 326, in _subx template = _compile_repl(template, pattern) File "/usr/local/lib/python3.10/re.py", line 317, in _compile_repl return sre_parse.parse_template(repl, pattern) File "/usr/local/lib/python3.10/sre_parse.py", line 1054, in parse_template raise s.error('bad escape %s' % this, len(this)) re.error: bad escape \w at position 177 (line 11, column 24) [27/Sep/2022 18:09:27] ERROR [django.request:241] Internal Server Error: /api/v3/WISyholVIzmwykYsBraCmppmJeKGOANFNLkdClIq/checkrunner/ Traceback (most recent call last): File "/usr/local/lib/python3.10/sre_parse.py", line 1051, in parse_template this = chr(ESCAPES[this][1]) KeyError: '\\e' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/rmm/api/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/rmm/api/env/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view return self.dispatch(request, *args, **kwargs) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/rmm/api/tacticalrmm/apiv3/views.py", line 269, in get ).data, File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 768, in data ret = super().data File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data self._data = self.to_representation(self.instance) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 686, in to_representation return [ File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 687, in <listcomp> self.child.to_representation(item) for item in iterable File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation ret[field.field_name] = field.to_representation(attribute) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/fields.py", line 1838, in to_representation return method(value) File "/rmm/api/tacticalrmm/checks/serializers.py", line 167, in get_script_args return Script.parse_script_args( File "/rmm/api/tacticalrmm/scripts/models.py", line 213, in parse_script_args temp_args.append(re.sub("\\{\\{.*\\}\\}", value, arg)) File "/usr/local/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) File "/usr/local/lib/python3.10/re.py", line 326, in _subx template = _compile_repl(template, pattern) File "/usr/local/lib/python3.10/re.py", line 317, in _compile_repl return sre_parse.parse_template(repl, pattern) File "/usr/local/lib/python3.10/sre_parse.py", line 1054, in parse_template raise s.error('bad escape %s' % this, len(this)) re.error: bad escape \e at position 6 [27/Sep/2022 18:11:27] ERROR [django.request:241] Internal Server Error: /api/v3/WISyholVIzmwykYsBraCmppmJeKGOANFNLkdClIq/checkrunner/ Traceback (most recent call last): File "/usr/local/lib/python3.10/sre_parse.py", line 1051, in parse_template this = chr(ESCAPES[this][1]) KeyError: '\\e' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/rmm/api/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/rmm/api/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/rmm/api/env/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view return self.dispatch(request, *args, **kwargs) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/rmm/api/tacticalrmm/apiv3/views.py", line 269, in get ).data, File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 768, in data ret = super().data File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data self._data = self.to_representation(self.instance) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 686, in to_representation return [ File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 687, in <listcomp> self.child.to_representation(item) for item in iterable File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation ret[field.field_name] = field.to_representation(attribute) File "/rmm/api/env/lib/python3.10/site-packages/rest_framework/fields.py", line 1838, in to_representation return method(value) File "/rmm/api/tacticalrmm/checks/serializers.py", line 167, in get_script_args return Script.parse_script_args( File "/rmm/api/tacticalrmm/scripts/models.py", line 213, in parse_script_args temp_args.append(re.sub("\\{\\{.*\\}\\}", value, arg)) File "/usr/local/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) File "/usr/local/lib/python3.10/re.py", line 326, in _subx template = _compile_repl(template, pattern) File "/usr/local/lib/python3.10/re.py", line 317, in _compile_repl return sre_parse.parse_template(repl, pattern) File "/usr/local/lib/python3.10/sre_parse.py", line 1054, in parse_template raise s.error('bad escape %s' % this, len(this)) re.error: bad escape \e at position 6 ```
kerem closed this issue 2026-03-02 02:19:10 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#806
No description provided.