{"record":{"id":"6b43d2ea1c8b8db8","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-getchatflowbyid-id-no","errorCode":null,"errorMessage":"Error: chatflowsController.getChatflowById - id not provided!","messagePattern":"Error: chatflowsController\\.getChatflowById - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":130,"sourceCode":"                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatflowsController.getChatflowByApiKey - apikey not provided!`\n            )\n        }\n        const apikey = await apiKeyService.getApiKey(req.params.apikey)\n        if (!apikey) {\n            return res.status(401).send('Unauthorized')\n        }\n        const apiResponse = await chatflowsService.getChatflowByApiKey(apikey.id, apikey.workspaceId, req.query.keyonly)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getChatflowById = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: chatflowsController.getChatflowById - id not provided!`)\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: chatflowsController.getChatflowById - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await chatflowsService.getChatflowById(req.params.id, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst saveChatflow = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.body) {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L112-L148","documentation":"Thrown by getChatflowById when req.params.id is missing. First guard in the handler, returns PRECONDITION_FAILED (412). Precedes the workspace check, so reaching it means the id was absent before authorization context was even examined.","triggerScenarios":"GET /api/v1/chatflows/:id called without an id segment; id variable undefined in client; route param name mismatch.","commonSituations":"Frontend navigates to detail route before an id is selected; SDK path change; proxy strip of the segment.","solutions":["Confirm the request URL has a non-empty id.","Guard the client call against undefined id.","Match client path to server route param name."],"exampleFix":"// before\nawait api.get(`/api/v1/chatflows/${row?.id}`)\n// after\nif (!row?.id) throw new Error('row id required')\nawait api.get(`/api/v1/chatflows/${row.id}`)","handlingStrategy":"validation","validationCode":"if (!id || typeof id !== 'string' || id.length === 0) {\n  throw new Error('chatflow id required')\n}","typeGuard":"function isNonEmptyId(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0\n}","tryCatchPattern":null,"preventionTips":["Guard the detail-view call against an undefined id.","Use a typed client wrapper that asserts id first.","Verify route param name on Flowise upgrades."],"tags":["flowise","express","params-validation","precondition","controller"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}