Welcome
What did you do?
We have an Evolution API v2.3.7 deployment (Docker Swarm + PostgreSQL) with multiple WhatsApp instances. One instance was created with the name "my instance " — with a trailing space at the end (likely from a copy-paste during creation). The trailing space is invisible in the UI but persisted in the database.
From that point on, every operation that targets the instance by name fails with 404, including:
DELETE /instance/delete/{instanceName} via API
DELETE /instance/logout/{instanceName} via API
- Clicking the Delete button in the Evolution Manager UI
The error returned is always:
{
"status": 404,
"error": "Not Found",
"response": { "message": ["The \"my instance\" instance does not exist"] }
}
Meanwhile, GET /instance/fetchInstances does return the instance correctly, and the UI lists and displays it normally — which makes the bug very confusing to diagnose.
Root cause (confirmed via DB inspection)
Querying the database directly:
SELECT id, name, length(name) AS len, encode(name::bytea, 'hex') AS hex
FROM "Instance"
WHERE name ILIKE '%carv%';
Result:
id | name | len | hex
--------------------------------------+------------+-----+------------------------
502f0dfa-14a7-4fdc-83f6-185e2ba90f66 | my instance | 11 | 636172762067726f7570 20
Decoding the hex confirms a trailing 0x20 (space) at the end of the name. The stored name is 11 chars, not 10.
Why operations fail
- The backend preserves the trailing space in path parameters correctly. Calling
DELETE /instance/delete/carv%20group%20 (with the trailing %20) via Postman or any HTTP client works and returns Instance deleted.
- The Evolution Manager UI, however, appears to drop the trailing space somewhere in the frontend (likely when reading the name from a rendered DOM element, an
innerText, or a state field that was implicitly trimmed). It ends up sending carv%20group (without the final %20), which does not match the stored name → 404.
So the backend match is strict (correct behavior), but the UI cannot delete its own instances when the stored name has trailing whitespace.
Expected behavior
Either (or both) of:
instanceName should be trimmed on creation. A .trim() in the createInstance controller before persisting to the database would prevent invalid names with leading/trailing whitespace from ever being stored. This is the cleanest fix.
- The Manager UI should preserve the exact stored name when issuing operations, including any trailing/leading whitespace, so its Delete/Logout/Connect buttons match what the backend expects.
Option 1 alone is enough to prevent the bug going forward. Option 2 also helps recover existing broken instances without requiring manual DB intervention.
Steps to reproduce
-
Create an instance via API with a name that has trailing whitespace, e.g. "test instance " (note the trailing space):
curl -X POST 'https://<server>/instance/create' \
-H 'apikey: <GLOBAL_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{"instanceName": "test instance ", "integration": "WHATSAPP-BAILEYS"}'
-
Confirm the instance appears in GET /instance/fetchInstances and in the Evolution Manager UI.
-
Try to delete it via the Delete button in the UI → 404 "instance does not exist".
-
Try DELETE /instance/delete/test%20instance → 404.
-
Try DELETE /instance/delete/test%20instance%20 (with trailing %20) → 200 Instance deleted.
Environment
- Evolution API version: v2.3.7
- Client name:
evolution_api_v2_carvgroup
- Deployment: Docker Swarm on Hetzner VPS
- Database: PostgreSQL 16.4
- Reverse proxy: Traefik
Workaround (for anyone hitting this)
Until the fix lands, you can either:
- Call the delete endpoint manually with the exact name including trailing whitespace properly URL-encoded (
%20 at the end), or
- Run
UPDATE "Instance" SET name = TRIM(name) WHERE id = '<uuid>'; in the database, then restart the Evolution container so the in-memory monitor reloads with the corrected name.
Happy to open a PR for the .trim() fix if maintainers agree on the approach.
Welcome
What did you do?
We have an Evolution API v2.3.7 deployment (Docker Swarm + PostgreSQL) with multiple WhatsApp instances. One instance was created with the name
"my instance "— with a trailing space at the end (likely from a copy-paste during creation). The trailing space is invisible in the UI but persisted in the database.From that point on, every operation that targets the instance by name fails with 404, including:
DELETE /instance/delete/{instanceName}via APIDELETE /instance/logout/{instanceName}via APIThe error returned is always:
{ "status": 404, "error": "Not Found", "response": { "message": ["The \"my instance\" instance does not exist"] } }Meanwhile,
GET /instance/fetchInstancesdoes return the instance correctly, and the UI lists and displays it normally — which makes the bug very confusing to diagnose.Root cause (confirmed via DB inspection)
Querying the database directly:
Result:
Decoding the hex confirms a trailing
0x20(space) at the end of the name. The stored name is 11 chars, not 10.Why operations fail
DELETE /instance/delete/carv%20group%20(with the trailing%20) via Postman or any HTTP client works and returnsInstance deleted.innerText, or a state field that was implicitly trimmed). It ends up sendingcarv%20group(without the final%20), which does not match the stored name → 404.So the backend match is strict (correct behavior), but the UI cannot delete its own instances when the stored name has trailing whitespace.
Expected behavior
Either (or both) of:
instanceNameshould be trimmed on creation. A.trim()in thecreateInstancecontroller before persisting to the database would prevent invalid names with leading/trailing whitespace from ever being stored. This is the cleanest fix.Option 1 alone is enough to prevent the bug going forward. Option 2 also helps recover existing broken instances without requiring manual DB intervention.
Steps to reproduce
Create an instance via API with a name that has trailing whitespace, e.g.
"test instance "(note the trailing space):Confirm the instance appears in
GET /instance/fetchInstancesand in the Evolution Manager UI.Try to delete it via the Delete button in the UI → 404 "instance does not exist".
Try
DELETE /instance/delete/test%20instance→ 404.Try
DELETE /instance/delete/test%20instance%20(with trailing%20) → 200 Instance deleted.Environment
evolution_api_v2_carvgroupWorkaround (for anyone hitting this)
Until the fix lands, you can either:
%20at the end), orUPDATE "Instance" SET name = TRIM(name) WHERE id = '<uuid>';in the database, then restart the Evolution container so the in-memory monitor reloads with the corrected name.Happy to open a PR for the
.trim()fix if maintainers agree on the approach.