{"record":{"id":"e1357d9e1d140516","repo":"mem0ai/mem0","slug":"at-least-one-message-is-required","errorCode":null,"errorMessage":"At least one message is required","messagePattern":"At least one message is required","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"critical","filePath":"integrations/n8n-nodes-mem0/nodes/Mem0/Mem0.node.ts","lineNumber":405,"sourceCode":"\t\t\t\t// First-party usage attribution: the backend reads `source` (same as OpenClaw).\n\t\t\t\tqs: { source: 'N8N', ...(qs ?? {}) },\n\t\t\t};\n\t\t\treturn (await this.helpers.httpRequestWithAuthentication.call(\n\t\t\t\tthis,\n\t\t\t\t'mem0Api',\n\t\t\t\toptions,\n\t\t\t)) as IDataObject;\n\t\t};\n\n\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\ttry {\n\t\t\t\tconst operation = this.getNodeParameter('operation', i) as string;\n\t\t\t\tlet responseData: IDataObject | IDataObject[] = {};\n\n\t\t\t\tif (operation === 'add') {\n\t\t\t\t\tconst messagesUi = this.getNodeParameter('messages.message', i, []) as IDataObject[];\n\t\t\t\t\tif (!messagesUi.length) {\n\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'At least one message is required', {\n\t\t\t\t\t\t\titemIndex: i,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconst addFields = this.getNodeParameter('addFields', i, {}) as IDataObject;\n\t\t\t\t\tconst body: IDataObject = {\n\t\t\t\t\t\tmessages: messagesUi.map((m) => ({ role: m.role, content: m.content })),\n\t\t\t\t\t\tinfer: addFields.infer !== undefined ? addFields.infer : true,\n\t\t\t\t\t};\n\t\t\t\t\tconst userId = this.getNodeParameter('userId', i, '') as string;\n\t\t\t\t\tif (userId) body.user_id = userId;\n\t\t\t\t\tif (addFields.agent_id) body.agent_id = addFields.agent_id;\n\t\t\t\t\tif (addFields.app_id) body.app_id = addFields.app_id;\n\t\t\t\t\tif (addFields.run_id) body.run_id = addFields.run_id;\n\t\t\t\t\tif (addFields.metadata) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tbody.metadata =\n\t\t\t\t\t\t\t\ttypeof addFields.metadata === 'string'\n\t\t\t\t\t\t\t\t\t? JSON.parse(addFields.metadata as string)","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/integrations/n8n-nodes-mem0/nodes/Mem0/Mem0.node.ts#L387-L423","documentation":"A RuntimeError raised at module import time of server/main.py: JWT-based authentication is compiled in unless AUTH_DISABLED=true, and it requires the JWT_SECRET env var to sign/verify tokens. If AUTH_DISABLED is falsy and JWT_SECRET is empty/unset, the server refuses to boot with this message rather than running with an insecure default secret.","triggerScenarios":"Starting the FastAPI server (python main.py, uvicorn, or the Docker container) without JWT_SECRET in the environment/.env and without AUTH_DISABLED=true. Typical after cloning the repo, copying .env.example incompletely, or running a minimal docker run that only passes DB vars.","commonSituations":"First self-hosted deployment; CI pipeline that only sets POSTGRES_* variables; upgrading to a server version that introduced mandatory JWT_SECRET; .env file not mounted into the container so the var never reaches the process.","solutions":["Generate a strong secret and set it: JWT_SECRET=$(openssl rand -base64 48) in server/.env (or the container environment), then restart.","For purely local development you may set AUTH_DISABLED=true instead — never in production or on a network-reachable host.","If using Docker Compose, ensure the env var is passed (environment: or env_file:) to the api service and the .env file is actually mounted.","Verify with: docker exec <container> printenv JWT_SECRET (name only — do not log the value)."],"exampleFix":"# before  (.env)\nPOSTGRES_URL=...\n\n# after  (.env)\nPOSTGRES_URL=...\nJWT_SECRET=<output of: openssl rand -base64 48>","handlingStrategy":"validation","validationCode":"import os, secrets\n\ndef require_jwt_secret() -> str:\n    secret = os.environ.get(\"JWT_SECRET\", \"\").strip()\n    if not secret and os.environ.get(\"AUTH_DISABLED\", \"\").lower() != \"true\":\n        secret = secrets.token_urlsafe(48)  # dev-only fallback; persist it or boot fails next time\n    if not secret:\n        raise RuntimeError(\"JWT_SECRET missing and AUTH_DISABLED!=true\")\n    return secret","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add JWT_SECRET to the deployment checklist alongside DB credentials.","Use 'openssl rand -base64 48' to generate; store in a secret manager.","Container healthcheck should fail fast on missing critical env vars."],"tags":["configuration","auth","jwt","startup","rest-server"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}