{"record":{"id":"616c7e0e5be68478","repo":"FlowiseAI/Flowise","slug":"error-custommcpserverscontroller-createcustommcps","errorCode":null,"errorMessage":"Error: customMcpServersController.createCustomMcpServer - body not provided!","messagePattern":"Error: customMcpServersController\\.createCustomMcpServer - body not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"warning","filePath":"packages/server/src/controllers/custom-mcp-servers/index.ts","lineNumber":26,"sourceCode":"const MAX_PAGE_LIMIT = 500\nconst DEFAULT_PAGE = 1\nconst DEFAULT_LIMIT = 50\n\nconst assertValidAuthType = (authType: unknown, endpoint: string): void => {\n    if (authType === undefined) return\n    const allowed = Object.values(CustomMcpServerAuthType) as string[]\n    if (typeof authType !== 'string' || !allowed.includes(authType)) {\n        throw new InternalFlowiseError(\n            StatusCodes.BAD_REQUEST,\n            `Error: customMcpServersController.${endpoint} - invalid authType \"${String(authType)}\"`\n        )\n    }\n}\n\nconst createCustomMcpServer = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.body) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: customMcpServersController.createCustomMcpServer - body not provided!`\n            )\n        }\n        const orgId = req.user?.activeOrganizationId\n        if (!orgId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: customMcpServersController.createCustomMcpServer - organization not found!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: customMcpServersController.createCustomMcpServer - workspace not found!`\n            )\n        }","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/custom-mcp-servers/index.ts#L8-L44","documentation":"Thrown by createCustomMcpServer when req.body is falsy — the first guard in the handler. Same shape as the credentials body-not-provided error: fires for an empty POST body, a missing Content-Type: application/json header, or a body-parser misconfiguration. Returns HTTP 412 PRECONDITION_FAILED.","triggerScenarios":"POST /api/v1/custom-mcp-servers sent with no body or without Content-Type: application/json so the JSON parser skips it. A client calling createCustomMcpServer(undefined). Body parser not mounted before this route.","commonSituations":"Frontend form submitted with no fields, or fetch with no body argument. Wrong/missing Content-Type header. express.json() registered after the MCP routes. Test passing undefined as the body.","solutions":["Confirm the POST has a JSON body containing at least name and serverUrl, with Content-Type: application/json.","On the client, default to an empty object: api.createCustomMcpServer(payload || {}).","Verify express.json() is mounted before the custom-mcp-servers routes.","Check that the body size is under the configured JSON limit.","In tests, pass a real object as the body."],"exampleFix":"// before\nawait fetch('/api/v1/custom-mcp-servers', { method: 'POST' })\n\n// after\nawait fetch('/api/v1/custom-mcp-servers', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ name: '...', serverUrl: '...', authType: 'NONE' })\n})","handlingStrategy":"validation","validationCode":"function requireCreateBody(body: unknown): Record<string, unknown> {\n  if (!body || typeof body !== 'object' || Array.isArray(body)) {\n    throw new Error('createCustomMcpServer requires a JSON body')\n  }\n  return body\n}\n\nconst body = requireCreateBody(payload)\nawait api.createCustomMcpServer(body)","typeGuard":"function isPlainObject(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && !Array.isArray(v)\n}","tryCatchPattern":"try {\n  await api.createCustomMcpServer(payload)\n} catch (e) {\n  if (e.status === 412 && /body not provided/.test(e.message)) {\n    // ensure Content-Type + non-empty body, then retry once\n    return api.createCustomMcpServer(payload ?? {})\n  }\n  throw e\n}","preventionTips":["Always send Content-Type: application/json with a non-empty JSON object on POST.","Mount express.json() before the custom-mcp-servers routes.","In tests, pass a real object — never undefined."],"tags":["validation","request-body","client-bug","mcp","flowise"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}