{"record":{"id":"155e363723a9775a","repo":"FlowiseAI/Flowise","slug":"error-credentialscontroller-updatecredential-id","errorCode":null,"errorMessage":"Error: credentialsController.updateCredential - id not provided!","messagePattern":"Error: credentialsController\\.updateCredential - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"warning","filePath":"packages/server/src/controllers/credentials/index.ts","lineNumber":108,"sourceCode":"        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: credentialsController.revealCredentialById - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await credentialsService.revealCredentialById(req.params.id, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst updateCredential = 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.updateCredential - id not provided!`\n            )\n        }\n        if (!req.body) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: credentialsController.updateCredential - body not provided!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: credentialsController.updateCredential - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await credentialsService.updateCredential(req.params.id, req.body, workspaceId)","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/credentials/index.ts#L90-L126","documentation":"Thrown by updateCredential when req.params.id is missing or empty. This is the first guard in the handler, checked before the body and workspace guards. Returns HTTP 412 PRECONDITION_FAILED.","triggerScenarios":"PUT/PATCH /api/v1/credentials/ (no id) or /api/v1/credentials/undefined when updating a credential. The frontend typically builds the URL from a row's id that is null on first render.","commonSituations":"Edit form submitted before a credential row is selected. URL built from a destructured prop that is undefined. Route mis-registered without :id.","solutions":["Check the outgoing PUT URL has a UUID id segment.","Disable the Save/Update button in the UI until a credential with a non-empty id is selected.","Validate id is a non-empty string before constructing the request.","Confirm route registration includes :id (e.g. app.put('/credentials/:id', ...))."],"exampleFix":"// before\nawait api.updateCredential(editingId, payload) // editingId may be undefined\n\n// after\nif (typeof editingId !== 'string' || editingId.length === 0) {\n  throw new Error('Cannot update: no credential id')\n}\nawait api.updateCredential(editingId, payload)","handlingStrategy":"type-guard","validationCode":"function requireCredentialId(id: unknown): string {\n  if (typeof id !== 'string' || id.trim().length === 0) {\n    throw new Error('credential id required to update')\n  }\n  return id\n}\n\nconst id = requireCredentialId(editingId)\nawait api.updateCredential(id, payload)","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.length > 0\n}","tryCatchPattern":"try {\n  await api.updateCredential(id, payload)\n} catch (e) {\n  if (e.status === 412 && /id not provided/.test(e.message)) {\n    // caller bug — do not retry\n    console.error('update called without an id')\n    return\n  }\n  throw e\n}","preventionTips":["Disable the Save button until a row with a non-empty id is in edit mode.","Validate id and payload together in a single helper before issuing the PUT.","Use TypeScript so the update function's signature requires a string id."],"tags":["validation","rest-params","client-bug","credentials","flowise"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}