FlowiseAI/Flowise · error · InternalFlowiseError

logIds must be a string[]

Error message

logIds must be a string[]

What it means

Thrown by deleteScheduleTriggerLogs when req.body.logIds is not an array of strings. This is a shape-validation guard (BAD_REQUEST / 400), stricter than the param guards. It rejects arrays containing non-strings and any non-array value, because the service expects string[] log identifiers.

Source

Thrown at packages/server/src/controllers/chatflows/index.ts:407

const deleteScheduleTriggerLogs = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params?.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                'Error: chatflowsController.deleteScheduleTriggerLogs - id not provided!'
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                'Error: chatflowsController.deleteScheduleTriggerLogs - workspace not found!'
            )
        }
        const logIds: unknown = req.body?.logIds
        if (!Array.isArray(logIds) || logIds.some((x) => typeof x !== 'string')) {
            throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'logIds must be a string[]')
        }
        const result = await scheduleService.deleteTriggerLogs(req.params.id, workspaceId, logIds as string[])
        return res.json(result)
    } catch (error) {
        next(error)
    }
}

const toggleScheduleEnabled = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params?.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                'Error: chatflowsController.toggleScheduleEnabled - id not provided!'
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Send { "logIds": ["<id1>", "<id2>"] } with Content-Type: application/json.
  2. Coerce each selected id to a string before sending (String(id)).
  3. Ensure body-parsing middleware (express.json()) runs before this route, otherwise req.body is undefined and fails the check.

Example fix

// before
fetch(url, { method: 'DELETE', body: JSON.stringify({ logIds: [1, 2] }) })
// after
fetch(url, {
  method: 'DELETE',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ logIds: ['1', '2'] })
})
Defensive patterns

Strategy: type-guard

Validate before calling

function toLogIdsPayload(v: unknown): string[] {
  const arr = Array.isArray(v) ? v : v == null ? [] : [v]
  return arr.map((x) => String(x))
}

Type guard

const isStringArray = (v: unknown): v is string[] => Array.isArray(v) && v.every((x) => typeof x === 'string')

Try / catch

try { await api.deleteTriggerLogs(id, logIds) } catch (e) { if (e.statusCode === 400 && /logIds/.test(e.message)) { logIds = logIds.map(String); await api.deleteTriggerLogs(id, logIds) } else throw e }

Prevention

When it happens

Trigger: The request body omits logIds, sends a single string instead of an array, sends numeric ids, or sends an array containing numbers/objects/null.

Common situations: Frontend sends selected row ids as numbers from a DB, a single id instead of [id], JSON body not parsed (Content-Type missing so req.body is a string/undefined), or a stale payload format after a contract change.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/c9ef08e5aea88cb4. Report an issue: GitHub.