ChatbotX icon indicating copy to clipboard operation
ChatbotX copied to clipboard

Keywords: creating a keyword with "Send text" fails with `invalid input syntax for type bigint: ""`

Open andreus1610 opened this issue 1 month ago • 2 comments

Have you checked for existing requests?

  • [x] I have searched the existing issues and found no similar request.

Affected Component

⚙️ Keywords Automation

Deployment Environment

Self-Hosted (Docker Compose)

ChatbotX Version

v1.17.1 (official images tagged 1.17.1, run on Docker Swarm via Easypanel)

Describe the bug

Creating a contact keyword in text mode ("Send text") always fails with the toast "Something went wrong while executing the operation." Nothing is saved. The builder log shows the database error invalid input syntax for type bigint: "". Keywords that reply with a flow work fine.

From reading the code (the same lines are on main):

  • create-automated-response-form.tsx: the form default is flowId: "", and the "Send text" tab calls setValue("flowId", "").
  • createAutomatedResponseRequest allows it on purpose: flowId: z.string().length(0).or(zodBigintAsString()).
  • packages/business/src/automated-response/service.ts, create(): const flowId = values.flowId ?? undefined keeps the empty string, which is then inserted into the bigint "flowId" column. I did not check whether update() has the same pattern.

Steps To Reproduce

  1. Keywords -> Create automated response (/space//automated-responses/create).
  2. Type a keyword, e.g. "test".
  3. Choose "Send text" and type any text.
  4. Click Confirm.

Expected behavior

The keyword is saved with the text reply and a null flowId.

Screenshots or Error Logs

Failed query: insert into "AutomatedResponse" ("id", "createdAt", "updatedAt", "workspaceId", "folderId", "keywords", "status", "text", "flowId", "type") values ($1, default, default, $2, $3, $4, $5, $6, $7, $8) returning ... params: ,,,{"test"},true,,,inbound: invalid input syntax for type bigint: ""

Suggested fix: const flowId = values.flowId || undefined in create().

andreus1610 avatar Nov 01 '26 18:11 andreus1610

I'll take this — empty flowId ("") from the "Send text" form should coerce to undefined before hitting the bigint column (values.flowId || undefined in create/update). Planning a focused fix + regression test.

rqms40 avatar Nov 07 '26 01:11 rqms40

Looks like this was fixed on main in #1617 (const flowId = values.flowId || undefined in automated-response/service.ts create). Withdrawing my claim — happy for a maintainer to close if the v1.17.1 report is covered by that release train.

rqms40 avatar Nov 07 '26 01:11 rqms40