Semantic-Org/Semantic-UI · warning

{name} cannot be longer than {ruleValue} characters

Error message

{name} cannot be longer than {ruleValue} characters

What it means

Default prompt for the Semantic UI Form `maxLength` rule (settings.rules.maxLength, form.js:1510). Shown when `value.length > maxLength`. Guarded against undefined value (returns false).

Source

Thrown at src/definitions/behaviors/form.js:1273

    checked              : '{name} must be checked',
    email                : '{name} must be a valid e-mail',
    url                  : '{name} must be a valid url',
    regExp               : '{name} is not formatted correctly',
    integer              : '{name} must be an integer',
    decimal              : '{name} must be a decimal number',
    number               : '{name} must be set to a number',
    is                   : '{name} must be "{ruleValue}"',
    isExactly            : '{name} must be exactly "{ruleValue}"',
    not                  : '{name} cannot be set to "{ruleValue}"',
    notExactly           : '{name} cannot be set to exactly "{ruleValue}"',
    contain              : '{name} must contain "{ruleValue}"',
    containExactly       : '{name} must contain exactly "{ruleValue}"',
    doesntContain        : '{name} cannot contain  "{ruleValue}"',
    doesntContainExactly : '{name} cannot contain exactly "{ruleValue}"',
    minLength            : '{name} must be at least {ruleValue} characters',
    length               : '{name} must be at least {ruleValue} characters',
    exactLength          : '{name} must be exactly {ruleValue} characters',
    maxLength            : '{name} cannot be longer than {ruleValue} characters',
    match                : '{name} must match {ruleValue} field',
    different            : '{name} must have a different value than {ruleValue} field',
    creditCard           : '{name} must be a valid credit card number',
    minCount             : '{name} must have at least {ruleValue} choices',
    exactCount           : '{name} must have exactly {ruleValue} choices',
    maxCount             : '{name} must have {ruleValue} or less choices'
  },

  selector : {
    checkbox   : 'input[type="checkbox"], input[type="radio"]',
    clear      : '.clear',
    field      : 'input, textarea, select',
    group      : '.field',
    input      : 'input',
    message    : '.error.message',
    prompt     : '.prompt.label',
    radio      : 'input[type="radio"]',
    reset      : '.reset:not([type="reset"])',

View on GitHub (pinned to 597843ab84)

Solutions

  1. Shorten the value to at most the maximum.
  2. Confirm the bracket value is the maximum (not the minimum).
  3. Add a live character counter matching the rule.
  4. Add a custom `prompt`.

Example fix

// before
rules: [{ type: 'maxLength[140]' }]

// after
rules: [{ type: 'maxLength[140]', prompt: 'Keep it under 140 characters' }]
Defensive patterns

Strategy: validation

Validate before calling

const max = 140;
if (($field.val() || '').length > max) { /* warn */ }

Type guard

const withinMaxLength = (v, max) => String(v).length <= max;

Prevention

When it happens

Trigger: `{type:'maxLength[140]'}` with input of 141+ characters; pasted text exceeding a tweet-style limit.

Common situations: Bio/status fields, SMS previews, textarea limits; counting characters where the UI shows a different counter.

Related errors


AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13). Data as JSON: /api/errors/ee64608cbe459526. Report an issue: GitHub.