Semantic-Org/Semantic-UI · warning

{name} must be exactly {ruleValue} characters

Error message

{name} must be exactly {ruleValue} characters

What it means

Default prompt for the Semantic UI Form `exactLength` rule (settings.rules.exactLength, form.js:1502). Shown when `value.length != requiredLength`. Guarded against undefined value (returns false).

Source

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

    empty                : '{name} must have a value',
    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"]',

View on GitHub (pinned to 597843ab84)

Solutions

  1. Enter exactly the required number of characters.
  2. Double-check the configured length matches the spec.
  3. Add a custom `prompt` stating the exact count.

Example fix

// before
rules: [{ type: 'exactLength[6]' }]

// after
rules: [{ type: 'exactLength[6]', prompt: 'Enter the 6-digit code' }]
Defensive patterns

Strategy: validation

Validate before calling

const n = 6;
if (($field.val() || '').length !== n) { /* warn */ }

Type guard

const isExactLength = (v, n) => String(v).length === n;

Prevention

When it happens

Trigger: `{type:'exactLength[6]'}` with input `12345` (5) or `1234567` (7). Common for OTP/pin/code fields.

Common situations: OTP codes, postal codes, serial numbers; off-by-one in the configured length.

Related errors


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