FlowiseAI/Flowise · warning · InternalFlowiseError

Error: assistantsController.deleteAssistant - id not provide

Error message

Error: assistantsController.deleteAssistant - id not provided!

What it means

Thrown by deleteAssistant with HTTP 412 when req.params is undefined or req.params.id is falsy. Mounted at DELETE /api/v1/assistants via routes/assistants/index.ts:18 which registers both '/' and '/:id', so the root form (DELETE /api/v1/assistants/) hits this guard.

Source

Thrown at packages/server/src/controllers/assistants/index.ts:49

        }
        const subscriptionId = req.user?.activeOrganizationSubscriptionId || ''

        const existingAssistantCount = await assistantsService.getAssistantsCountByOrganization(body.type, orgId)
        const newAssistantCount = 1
        await checkUsageLimit('flows', subscriptionId, getRunningExpressApp().usageCacheManager, existingAssistantCount + newAssistantCount)

        const apiResponse = await assistantsService.createAssistant(body, orgId, workspaceId)

        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

const deleteAssistant = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (typeof req.params === 'undefined' || !req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: assistantsController.deleteAssistant - id not provided!`
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: assistantsController.deleteAssistant - workspace ${workspaceId} not found!`
            )
        }
        const apiResponse = await assistantsService.deleteAssistant(req.params.id, req.query.isDeleteBoth, workspaceId)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Call DELETE /api/v1/assistants/<id> with a real id.
  2. Guard id is a non-empty string before issuing the request.

Example fix

// before
await fetch(`${BASE}/api/v1/assistants/`, { method: 'DELETE', headers })

// after
if (!assistantId) throw new Error('assistant id required')
await fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(assistantId)}`, { method: 'DELETE', headers })
Defensive patterns

Strategy: validation

Validate before calling

function assertId(id: unknown): string {
  if (typeof id !== 'string' || id.trim() === '') {
    throw new Error('assistant id is required')
  }
  return id
}
const id = assertId(selectedId)
await fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(id)}`, { method: 'DELETE', headers })

Type guard

const isNonEmptyString = (v: unknown): v is string =>
  typeof v === 'string' && v.trim().length > 0

Prevention

When it happens

Trigger: DELETE /api/v1/assistants/ (no id). Client building the URL from an empty id variable so the final segment is absent. As elsewhere, the literal 'undefined' string does NOT trigger this.

Common situations: Bulk-delete or test script iterating an empty id list and hitting the collection root; UI delete action with no assistant selected.

Related errors


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