{"record":{"id":"e0b1108348be8afd","repo":"FlowiseAI/Flowise","slug":"error-assistantscontroller-deleteassistant-id-n","errorCode":null,"errorMessage":"Error: assistantsController.deleteAssistant - id not provided!","messagePattern":"Error: assistantsController\\.deleteAssistant - id not provided!","errorType":"validation","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"warning","filePath":"packages/server/src/controllers/assistants/index.ts","lineNumber":49,"sourceCode":"        }\n        const subscriptionId = req.user?.activeOrganizationSubscriptionId || ''\n\n        const existingAssistantCount = await assistantsService.getAssistantsCountByOrganization(body.type, orgId)\n        const newAssistantCount = 1\n        await checkUsageLimit('flows', subscriptionId, getRunningExpressApp().usageCacheManager, existingAssistantCount + newAssistantCount)\n\n        const apiResponse = await assistantsService.createAssistant(body, orgId, workspaceId)\n\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst deleteAssistant = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: assistantsController.deleteAssistant - id not provided!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: assistantsController.deleteAssistant - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await assistantsService.deleteAssistant(req.params.id, req.query.isDeleteBoth, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/assistants/index.ts#L31-L67","documentation":"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.","triggerScenarios":"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.","commonSituations":"Bulk-delete or test script iterating an empty id list and hitting the collection root; UI delete action with no assistant selected.","solutions":["Call DELETE /api/v1/assistants/<id> with a real id.","Guard id is a non-empty string before issuing the request."],"exampleFix":"// before\nawait fetch(`${BASE}/api/v1/assistants/`, { method: 'DELETE', headers })\n\n// after\nif (!assistantId) throw new Error('assistant id required')\nawait fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(assistantId)}`, { method: 'DELETE', headers })","handlingStrategy":"validation","validationCode":"function assertId(id: unknown): string {\n  if (typeof id !== 'string' || id.trim() === '') {\n    throw new Error('assistant id is required')\n  }\n  return id\n}\nconst id = assertId(selectedId)\nawait fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(id)}`, { method: 'DELETE', headers })","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0","tryCatchPattern":null,"preventionTips":["Never DELETE /api/v1/assistants/ (root); always include the id.","Disable the delete control until an assistant is selected.","Route deletes through a helper that rejects empty ids."],"tags":["validation","express","path-param","precondition-failed","flowise","assistants"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}