Mintplex-Labs/anything-llm · error
Bio cannot be longer than 1,000 characters
Error message
Bio cannot be longer than 1,000 characters
What it means
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.
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
Example fix
// before
await user.update(userId, { bio: fs.readFileSync("about.txt", "utf8") });
// after
await user.update(userId, { bio: bio.slice(0, 1000) }); Defensive patterns
Strategy: validation
Validate before calling
const MAX_BIO = 1000;
let bio = String(input.bio ?? "");
if (bio.length > MAX_BIO) bio = bio.slice(0, MAX_BIO); // or reject with 400
await user.update(userId, { bio }); Try / catch
try {
await user.update(userId, { bio });
} catch (e) {
if (/Bio cannot be longer/i.test(e.message)) return res.status(400).json({ error: e.message });
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Textareas without maxlength; data imports concatenating fields into bio; clients counting characters differently from the server; no live counter in the UI.
Related errors
- Daily message limit must be null or a number greater than…
- Invalid role. Allowed roles are
- Username must be at least 2 characters
- Username must start with a lowercase letter and only…
- addToWorkspaces must be a string of comma-separated…
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/997e035b76be29c5.
Report an issue: GitHub.
Appendix: source
Thrown at server/models/user.js:73
`Invalid role. Allowed roles are: ${VALID_ROLES.join(", ")}`
);
}
return String(role);
},
dailyMessageLimit: (dailyMessageLimit = null) => {
if (dailyMessageLimit === null) return null;
const limit = Number(dailyMessageLimit);
if (isNaN(limit) || limit < 1) {
throw new Error(
"Daily message limit must be null or a number greater than or equal to 1"
);
}
return limit;
},
bio: (bio = "") => {
if (!bio || typeof bio !== "string") return "";
if (bio.length > 1000)
throw new Error("Bio cannot be longer than 1,000 characters");
return String(bio);
},
},
// validations for the above writable fields.
castColumnValue: function (key, value) {
switch (key) {
case "suspended":
return Number(Boolean(value));
case "dailyMessageLimit":
return value === null ? null : Number(value);
default:
return String(value);
}
},
filterFields: function (user = {}) {
const {
password: _password,View on GitHub (pinned to 3aec848f28)