{"record":{"id":"49fb5affcd66fb22","repo":"FlowiseAI/Flowise","slug":"error-credentialscontroller-deletecredentials-i","errorCode":null,"errorMessage":"Error: credentialsController.deleteCredentials - id not provided!","messagePattern":"Error: credentialsController\\.deleteCredentials - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/credentials/index.ts","lineNumber":26,"sourceCode":"        if (!req.body) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: credentialsController.createCredential - body not provided!`\n            )\n        }\n        const body = req.body\n        body.workspaceId = req.user?.activeWorkspaceId\n        const apiResponse = await credentialsService.createCredential(body)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst deleteCredentials = 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: credentialsController.deleteCredentials - id not provided!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: credentialsController.deleteCredentials - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await credentialsService.deleteCredentials(req.params.id, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/credentials/index.ts#L8-L44","documentation":"Thrown by credentialsController.deleteCredentials when req.params.id is falsy. The endpoint deletes a stored credential scoped to the caller's workspace, so the credential id is mandatory. Returned as PRECONDITION_FAILED (412). Note the same handler later throws a workspace-not-found error whose message interpolates the undefined workspaceId (a minor logging quirk).","triggerScenarios":"A DELETE request whose path omits the :id segment, or a route registration without :id so req.params.id is undefined.","commonSituations":"Delete button fired before an id is bound, URL built from a null id, or router mounted the handler on a bare path.","solutions":["Include the credential id in the DELETE path.","Guard the delete action on a selected credential id on the client.","Confirm the route declares :id."],"exampleFix":"// before\nfetch(`/api/v1/credentials/`, { method: 'DELETE' })\n// after\nfetch(`/api/v1/credentials/${encodeURIComponent(credentialId)}`, { method: 'DELETE' })","handlingStrategy":"validation","validationCode":"function deleteCredential(id: string) {\n  if (!id) throw new Error('credential id required')\n  return fetch(`/api/v1/credentials/${encodeURIComponent(id)}`, { method: 'DELETE' })\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0","tryCatchPattern":"try { await deleteCredential(id) } catch (e) { if (e.statusCode === 412) throw new Error('provide a credential id') }","preventionTips":["Bind the delete action to a selected credential.","Validate id presence client-side.","Confirm the route declares :id."],"tags":["flowise","controller","validation","precondition-failed","path-param","credentials","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}