Billionmail/BillionMail · error

configuration value too long, maximum 1024 characters

Error message

configuration value too long, maximum 1024 characters

What it means

validateConfigValue rejects any system configuration value longer than 1024 bytes (raw len(value), i.e. bytes not characters). SetSystemConfig and SetSystemConfigKey call this validator before persisting, so oversized values are refused. It protects config storage and downstream consumers from unbounded values.

Source

Thrown at core/internal/controller/settings/settings.go:187

		config.RetentionDays = parseInt(retentionDays, 7)
	}

	return config
}

// parseInt Safely convert string to integer
func parseInt(s string, defaultValue int) int {
	if v, err := strconv.Atoi(s); err == nil {
		return v
	}
	return defaultValue
}

// validateConfigValue
func validateConfigValue(key, value string) error {
	// Basic length check
	if len(value) > 1024 {
		return fmt.Errorf("configuration value too long, maximum 1024 characters")
	}

	switch key {
	case "ADMIN_USERNAME", "admin_username":
		// Admin username: allowed letters, numbers, underscores, length 4-32
		if len(value) < 4 || len(value) > 32 {
			return fmt.Errorf("admin username length must be between 4-32")
		}
		if !public.IsValidUsername(value) {
			return fmt.Errorf("admin username can only contain letters, numbers and underscores")
		}

	case "ADMIN_PASSWORD", "admin_password":
		if len(value) < 4 {
			return fmt.Errorf("password length must be at least 4 characters")
		}

	case "BILLIONMAIL_HOSTNAME", "billionmail_hostname":

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Shorten the value to <=1024 characters (bytes)
  2. Move large content (HTML, JSON, attachments) to a dedicated table/file instead of a config key
  3. Split long lists into multiple keys if the schema allows
  4. Use len(value) in your client to check the size before submitting

Example fix

// before
setValue("SMTP_RELAY_HOSTS", strings.Join(manyHosts, ",")) // > 1024 chars
// after
setValue("SMTP_RELAY_HOSTS", strings.Join(manyHosts, ","))
// ensure len(value) <= 1024, or persist in a dedicated table instead
Defensive patterns

Strategy: validation

Validate before calling

function isValidConfigValue(value) {
  return typeof value === 'string' && value.length <= 1024;
}

Type guard

function isShortString(v: unknown): v is string {
  return typeof v === 'string' && v.length <= 1024;
}

Prevention

When it happens

Trigger: Calling SetSystemConfig/SetSystemConfigKey with any value whose byte length exceeds 1024 — e.g. pasting a very long SMTP host list, HTML blob, or multi-line signature into a config field.

Common situations: Storing a full HTML footer/signature or large JSON in a plain config key; concatenating many hosts into one value; pasting base64 data into a text config field.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/fe7522b95a3e4018. Report an issue: GitHub.