{"record":{"id":"997e035b76be29c5","repo":"Mintplex-Labs/anything-llm","slug":"bio-cannot-be-longer-than-1-000-characters","errorCode":null,"errorMessage":"Bio cannot be longer than 1,000 characters","messagePattern":"Bio cannot be longer than 1,000 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/models/user.js","lineNumber":73,"sourceCode":"          `Invalid role. Allowed roles are: ${VALID_ROLES.join(\", \")}`\n        );\n      }\n      return String(role);\n    },\n    dailyMessageLimit: (dailyMessageLimit = null) => {\n      if (dailyMessageLimit === null) return null;\n      const limit = Number(dailyMessageLimit);\n      if (isNaN(limit) || limit < 1) {\n        throw new Error(\n          \"Daily message limit must be null or a number greater than or equal to 1\"\n        );\n      }\n      return limit;\n    },\n    bio: (bio = \"\") => {\n      if (!bio || typeof bio !== \"string\") return \"\";\n      if (bio.length > 1000)\n        throw new Error(\"Bio cannot be longer than 1,000 characters\");\n      return String(bio);\n    },\n  },\n  // validations for the above writable fields.\n  castColumnValue: function (key, value) {\n    switch (key) {\n      case \"suspended\":\n        return Number(Boolean(value));\n      case \"dailyMessageLimit\":\n        return value === null ? null : Number(value);\n      default:\n        return String(value);\n    }\n  },\n\n  filterFields: function (user = {}) {\n    const {\n      password: _password,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/models/user.js#L55-L91","documentation":"Thrown when the bio string exceeds 1,000 characters. Empty or non-string bios are coerced to \"\" and allowed; only oversize strings fail, and the whole update is rejected rather than truncated. The server counts UTF-16 code units (String.length), so inputs that look like ~1,000 grapheme clusters can still exceed the limit.","triggerScenarios":"user.update(userId, { bio: longText }) where bio.length > 1000; pasting a long \"about me\" through the profile endpoint; merging multiple bio sources during a data import; emoji-heavy text where code units exceed the visible character count.","commonSituations":"Textareas without maxlength; data imports concatenating fields into bio; clients counting characters differently from the server; no live counter in the UI.","solutions":["Shorten the bio to 1,000 characters or fewer","Add maxlength=1000 and a live character counter to the bio textarea","Truncate deterministically (bio.slice(0, 1000)) before submit if the field is non-essential","For imports, normalize then slice to 1,000 characters"],"exampleFix":"// before\nawait user.update(userId, { bio: fs.readFileSync(\"about.txt\", \"utf8\") });\n\n// after\nawait user.update(userId, { bio: bio.slice(0, 1000) });","handlingStrategy":"validation","validationCode":"const MAX_BIO = 1000;\nlet bio = String(input.bio ?? \"\");\nif (bio.length > MAX_BIO) bio = bio.slice(0, MAX_BIO); // or reject with 400\nawait user.update(userId, { bio });","typeGuard":null,"tryCatchPattern":"try {\n  await user.update(userId, { bio });\n} catch (e) {\n  if (/Bio cannot be longer/i.test(e.message)) return res.status(400).json({ error: e.message });\n  throw e;\n}","preventionTips":["Set maxlength=1000 on the bio textarea with a live counter","Remember the server counts UTF-16 code units, not graphemes","Slice imported bios to 1,000 characters before calling update"],"tags":["validation","bio","max-length","user-management"],"backgroundTag":"max-length-exceeded","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}