[GH-ISSUE #1924] Cant move agent between sites #3142

Open
opened 2026-03-14 06:41:56 +03:00 by kerem · 7 comments
Owner

Originally created by @davew909 on GitHub (Jul 23, 2024).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1924

Server Info (please complete the following information):

  • OS: Debian 12
  • Browser: chrome
  • RMM Version (as shown in top left of web UI): v0.19.2

Installation Method:

  • Standard

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): v2.8.0
  • Agent OS: [e.g. Win 10 v2004, Server 2016] Windows 11 v23H2

Describe the bug
Moving agent to new site creates a 500: Internal Server Error

To Reproduce
Steps to reproduce the behavior:

  1. Right click agent
  2. Edit
  3. Change Site to a different site
  4. Press save
  5. Error 500: Internal Server Error appears at top of screen

Expected behavior
Agent to move to new site

Screenshots
If applicable, add screenshots to help explain your problem.

image

Additional context
Add any other context about the problem here.

Originally created by @davew909 on GitHub (Jul 23, 2024). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1924 **Server Info (please complete the following information):** - OS: Debian 12 - Browser: chrome - RMM Version (as shown in top left of web UI): v0.19.2 **Installation Method:** - [X] Standard **Agent Info (please complete the following information):** - Agent version (as shown in the 'Summary' tab of the agent from web UI): v2.8.0 - Agent OS: [e.g. Win 10 v2004, Server 2016] Windows 11 v23H2 **Describe the bug** Moving agent to new site creates a 500: Internal Server Error **To Reproduce** Steps to reproduce the behavior: 1. Right click agent 2. Edit 3. Change Site to a different site 4. Press save 5. Error 500: Internal Server Error appears at top of screen **Expected behavior** Agent to move to new site **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://github.com/user-attachments/assets/1b141338-932d-45e5-bf8c-59ae317105e1) **Additional context** Add any other context about the problem here.
Author
Owner

@dinger1986 commented on GitHub (Jul 23, 2024):

I can move agents to a new site without issues.

https://docs.tacticalrmm.com/troubleshooting/#error-500

<!-- gh-comment-id:2245430829 --> @dinger1986 commented on GitHub (Jul 23, 2024): I can move agents to a new site without issues. https://docs.tacticalrmm.com/troubleshooting/#error-500
Author
Owner

@davew909 commented on GitHub (Jul 23, 2024):

Hi,

This is what i get out of the Djano log:

tactical@core ~$ tail -f /rmm/api/tacticalrmm/tacticalrmm/private/log/django_debug.log
File "/rmm/api/env/lib/python3.11/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute
raise ex.with_traceback(None)
django.db.utils.NotSupportedError: conversion between UTF8 and SQL_ASCII is not supported
LINE 1: ...2:07:52.290475+00:00'::timestamptz, "services" = E'[{"pid":...
^
[23/Jul/2024 14:53:31] ERROR [log.py:log_response:241] Internal Server Error: /agents/amUVPqUWjKaQIAOYRHEPjsjVJUlnXVoTKxsLHATQ/
Traceback (most recent call last):
File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute
raise ex.with_traceback(None)
psycopg.errors.FeatureNotSupported: conversion between UTF8 and SQL_ASCII is not supported
LINE 1: ...2:07:52.290475+00:00'::timestamptz, "services" = E'[{"pid":...
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/rmm/api/env/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/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.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/tacticalrmm/agents/views.py", line 231, in put
s.save()
File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 203, in save
self.instance = self.update(self.instance, validated_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 1033, in update
instance.save()
File "/rmm/api/tacticalrmm/agents/models.py", line 148, in save
super().save(*args, **kwargs)
File "/rmm/api/tacticalrmm/logs/models.py", line 525, in save
super().save(*args, **kwargs)
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 814, in save
self.save_base(
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 877, in save_base
updated = self._save_table(
^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 990, in _save_table
updated = self._do_update(
^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 1054, in _do_update
return filtered._update(values) > 0
^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/query.py", line 1231, in _update
return query.get_compiler(self.db).execute_sql(CURSOR)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1984, in execute_sql
cursor = super().execute_sql(result_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/rmm/api/env/lib/python3.11/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rmm/api/env/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute
raise ex.with_traceback(None)
django.db.utils.NotSupportedError: conversion between UTF8 and SQL_ASCII is not supported
LINE 1: ...2:07:52.290475+00:00'::timestamptz, "services" = E'[{"pid":...

<!-- gh-comment-id:2245484330 --> @davew909 commented on GitHub (Jul 23, 2024): Hi, This is what i get out of the Djano log: tactical@core ~$ tail -f /rmm/api/tacticalrmm/tacticalrmm/private/log/django_debug.log File "/rmm/api/env/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) django.db.utils.NotSupportedError: conversion between UTF8 and SQL_ASCII is not supported LINE 1: ...2:07:52.290475+00:00'::timestamptz, "services" = E'[{"pid":... ^ [23/Jul/2024 14:53:31] ERROR [log.py:log_response:241] Internal Server Error: /agents/amUVPqUWjKaQIAOYRHEPjsjVJUlnXVoTKxsLHATQ/ Traceback (most recent call last): File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) psycopg.errors.FeatureNotSupported: conversion between UTF8 and SQL_ASCII is not supported LINE 1: ...2:07:52.290475+00:00'::timestamptz, "services" = E'[{"pid":... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/rmm/api/env/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/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.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view return view_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/tacticalrmm/agents/views.py", line 231, in put s.save() File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 203, in save self.instance = self.update(self.instance, validated_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 1033, in update instance.save() File "/rmm/api/tacticalrmm/agents/models.py", line 148, in save super().save(*args, **kwargs) File "/rmm/api/tacticalrmm/logs/models.py", line 525, in save super().save(*args, **kwargs) File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 814, in save self.save_base( File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 877, in save_base updated = self._save_table( ^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 990, in _save_table updated = self._do_update( ^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/base.py", line 1054, in _do_update return filtered._update(values) > 0 ^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/query.py", line 1231, in _update return query.get_compiler(self.db).execute_sql(CURSOR) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1984, in execute_sql cursor = super().execute_sql(result_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql cursor.execute(sql, params) File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/rmm/api/env/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/rmm/api/env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/rmm/api/env/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) django.db.utils.NotSupportedError: conversion between UTF8 and SQL_ASCII is not supported LINE 1: ...2:07:52.290475+00:00'::timestamptz, "services" = E'[{"pid":...
Author
Owner

@dinger1986 commented on GitHub (Jul 23, 2024):

so this thing here is pointing to something with the services on that agent services" = E'[{"pid

Can you check if theres any strangely named services?

Also what is the Agent OS?

<!-- gh-comment-id:2245659592 --> @dinger1986 commented on GitHub (Jul 23, 2024): so this thing here is pointing to something with the services on that agent `services" = E'[{"pid` Can you check if theres any strangely named services? Also what is the Agent OS?
Author
Owner

@silversword411 commented on GitHub (Jul 23, 2024):

Are you doing anything custom with the django/postgres database?

<!-- gh-comment-id:2245803549 --> @silversword411 commented on GitHub (Jul 23, 2024): Are you doing anything custom with the django/postgres database?
Author
Owner

@silversword411 commented on GitHub (Jul 23, 2024):

See https://github.com/amidaware/tacticalrmm/issues/1522
One of your services has a non supported character in it most likely. If you can find the service, can you post in the other issue. Thx!

<!-- gh-comment-id:2245822249 --> @silversword411 commented on GitHub (Jul 23, 2024): See https://github.com/amidaware/tacticalrmm/issues/1522 One of your services has a non supported character in it most likely. If you can find the service, can you post in the other issue. Thx!
Author
Owner

@wh1te909 commented on GitHub (Jul 23, 2024):

@davew909 can you please run the following script to dump your database. It will create a file named db-1924.psql.gz and then please send us that file by opening a ticket at https://support.amidaware.com

#!/usr/bin/env bash

POSTGRES_USER=$(/rmm/api/env/bin/python /rmm/api/tacticalrmm/manage.py get_config dbuser)
POSTGRES_PW=$(/rmm/api/env/bin/python /rmm/api/tacticalrmm/manage.py get_config dbpw)

pg_dump --no-privileges --no-owner --dbname=postgresql://"${POSTGRES_USER}":"${POSTGRES_PW}"@localhost:5432/tacticalrmm | gzip -9 >db-1924.psql.gz

<!-- gh-comment-id:2245887153 --> @wh1te909 commented on GitHub (Jul 23, 2024): @davew909 can you please run the following script to dump your database. It will create a file named `db-1924.psql.gz` and then please send us that file by opening a ticket at https://support.amidaware.com ``` #!/usr/bin/env bash POSTGRES_USER=$(/rmm/api/env/bin/python /rmm/api/tacticalrmm/manage.py get_config dbuser) POSTGRES_PW=$(/rmm/api/env/bin/python /rmm/api/tacticalrmm/manage.py get_config dbpw) pg_dump --no-privileges --no-owner --dbname=postgresql://"${POSTGRES_USER}":"${POSTGRES_PW}"@localhost:5432/tacticalrmm | gzip -9 >db-1924.psql.gz ```
Author
Owner

@davew909 commented on GitHub (Jul 24, 2024):

Hi I have submitted this as requested. I can’t see any services that look abnormal, these are freshly built Windows 11 machines 23H2

<!-- gh-comment-id:2247365516 --> @davew909 commented on GitHub (Jul 24, 2024): Hi I have submitted this as requested. I can’t see any services that look abnormal, these are freshly built Windows 11 machines 23H2
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#3142
No description provided.