{"record":{"id":"206e1855cdba5444","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-getsinglepublicchatflow","errorCode":null,"errorMessage":"Error: chatflowsController.getSinglePublicChatflow - id not provided!","messagePattern":"Error: chatflowsController\\.getSinglePublicChatflow - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":233,"sourceCode":"        const updateChatFlow = new ChatFlow()\n        Object.assign(updateChatFlow, stripProtectedFields(body))\n\n        updateChatFlow.id = chatflow.id\n        const rateLimiterManager = RateLimiterManager.getInstance()\n        await rateLimiterManager.updateRateLimiter(updateChatFlow)\n\n        const apiResponse = await chatflowsService.updateChatflow(chatflow, updateChatFlow, orgId, workspaceId, subscriptionId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getSinglePublicChatflow = async (req: Request, res: Response, next: NextFunction) => {\n    let queryRunner: QueryRunner | undefined\n    try {\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatflowsController.getSinglePublicChatflow - id not provided!`\n            )\n        }\n        const chatflow = await chatflowsService.getChatflowById(req.params.id)\n        if (!chatflow) return res.status(StatusCodes.NOT_FOUND).json({ message: 'Chatflow not found' })\n        if (chatflow.isPublic)\n            return res.status(StatusCodes.OK).json({ ...chatflow, flowData: sanitizeFlowDataForPublicEndpoint(chatflow.flowData) })\n        if (!req.user) return res.status(StatusCodes.UNAUTHORIZED).json({ message: GeneralErrorMessage.UNAUTHORIZED })\n        queryRunner = getRunningExpressApp().AppDataSource.createQueryRunner()\n        const workspaceUserService = new WorkspaceUserService()\n        const workspaceUser = await workspaceUserService.readWorkspaceUserByUserId(req.user.id, queryRunner)\n        if (workspaceUser.length === 0)\n            return res.status(StatusCodes.NOT_FOUND).json({ message: WorkspaceUserErrorMessage.WORKSPACE_USER_NOT_FOUND })\n        const workspaceIds = workspaceUser.map((user) => user.workspaceId)\n        if (!workspaceIds.includes(chatflow.workspaceId))\n            return res.status(StatusCodes.BAD_REQUEST).json({ message: 'You are not in the workspace that owns this chatflow' })\n        return res.status(StatusCodes.OK).json(chatflow)","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L215-L251","documentation":"Thrown by getSinglePublicChatflow when req.params.id is missing. PRECONDITION_FAILED (412) guard at the top of a public endpoint that may run without an authenticated user. After this check, the controller fetches the chatflow and gates visibility on chatflow.isPublic and workspace membership.","triggerScenarios":"Calling the public-chatflow endpoint without an id segment; client built the URL from an undefined variable.","commonSituations":"Embed snippet loaded before the chatflow id was injected; SDK path change; URL template typo.","solutions":["Ensure the request URL has a non-empty id.","Validate the id is set client-side before calling.","Confirm the embed/integration passes the correct chatflow id."],"exampleFix":"// before\nawait api.get(`/api/v1/public-chatflows/`)\n// after\nif (!chatflowId) throw new Error('chatflowId required')\nawait api.get(`/api/v1/public-chatflows/${chatflowId}`)","handlingStrategy":"validation","validationCode":"if (!id || typeof id !== 'string' || id.length === 0) {\n  throw new Error('chatflow id required for public fetch')\n}","typeGuard":"function isNonEmptyId(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0\n}","tryCatchPattern":null,"preventionTips":["Inject the chatflow id into embed snippets via templating with a fallback check.","Test embed snippets with a known-good id before shipping.","Keep a typed client wrapper for public endpoints."],"tags":["flowise","express","params-validation","precondition","public-endpoint","controller"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}