laurent22/joplin · error · ErrorUnprocessableEntity

Full name must be at most 256 characters

Error message

Full name must be at most 256 characters

What it means

UserModel.validate throws ErrorUnprocessableEntity('Full name must be at most 256 characters') when the user's full_name field exceeds 256 characters. This bounds the stored display name to fit the database column and UI layouts.

Solutions

  1. Truncate or shorten the full_name value to 256 characters or fewer before saving.
  2. Strip concatenated metadata from imported directory names.
  3. Enforce a maxlength=256 constraint on the name input in the client form.

Example fix

// before
await models.user().save({ email: 'a@b.com', password: 'x', full_name: veryLongName });
// after
const fullName = veryLongName.slice(0, 256);
await models.user().save({ email: 'a@b.com', password: 'x', full_name: fullName });
Defensive patterns

Strategy: validation

Validate before calling

if (user.full_name && user.full_name.length > 256) throw new Error('Full name too long');

Type guard

function isValidFullName(name?: string): boolean { return !name || name.length <= 256; }

Try / catch

try { await models.user().save(user, opts); } catch (e) { if (/Full name must be at most 256/.test(e.message)) /* truncate and retry */; }

Prevention

When it happens

Trigger: Saving or updating a user whose full_name string length is greater than 256 characters.

Common situations: Importing names from external directories (LDAP/CSV) that concatenate many fields; sync tools copying long 'displayName' attributes; users pasting long text into the name field.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of laurent22/joplin@981a03c5c9 (2026-09-17). Data as JSON: /api/errors/779381c01266d8cd. Report an issue: GitHub.

Appendix: source

Thrown at packages/server/src/models/UserModel.ts:481

		if (options.isNew) {
			if (!user.email) throw new ErrorUnprocessableEntity('email must be set');
			if ('email' in user && !user.email.includes('@')) throw new ErrorUnprocessableEntity(`Should include @ in email address, email: ${user.email}`);
			if (!user.password && !user.must_set_password) throw new ErrorUnprocessableEntity('password must be set');
		} else {
			if ('email' in user && !user.email) throw new ErrorUnprocessableEntity('email must be set');
			if (user.email && !user.email.includes('@')) throw new ErrorUnprocessableEntity(`Should include @ in email address, email: ${user.email}`);
			if ('password' in user && !user.password) throw new ErrorUnprocessableEntity('password must be set');
		}

		if (user.email) {
			const existingUser = await this.loadByEmail(user.email);
			if (existingUser && existingUser.id !== user.id) throw new ErrorUnprocessableEntity(`there is already a user with this email: ${user.email}`);
			// See https://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690 (found via https://stackoverflow.com/a/574698)
			if (user.email.length > 254) throw new ErrorUnprocessableEntity('Please enter an email address between 0 and 254 characters');
			validateEmail(user.email);
		}

		if (user.full_name && user.full_name.length > 256) throw new ErrorUnprocessableEntity('Full name must be at most 256 characters');

		return super.validate(user, options);
	}

	// public async delete(id: string): Promise<void> {
	// 	const shares = await this.models().share().sharesByUser(id);

	// 	await this.withTransaction(async () => {
	// 		await this.models().item().deleteExclusivelyOwnedItems(id);
	// 		await this.models().share().delete(shares.map(s => s.id));
	// 		await this.models().userItem().deleteByUserId(id);
	// 		await this.models().session().deleteByUserId(id);
	// 		await this.models().notification().deleteByUserId(id);
	// 		await super.delete(id);
	// 	}, 'UserModel::delete');
	// }

	private async confirmEmail(user: User) {

View on GitHub (pinned to 981a03c5c9)