{"record":{"id":"fe7522b95a3e4018","repo":"Billionmail/BillionMail","slug":"configuration-value-too-long-maximum-1024-charact","errorCode":null,"errorMessage":"configuration value too long, maximum 1024 characters","messagePattern":"configuration value too long, maximum 1024 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/controller/settings/settings.go","lineNumber":187,"sourceCode":"\t\tconfig.RetentionDays = parseInt(retentionDays, 7)\n\t}\n\n\treturn config\n}\n\n// parseInt Safely convert string to integer\nfunc parseInt(s string, defaultValue int) int {\n\tif v, err := strconv.Atoi(s); err == nil {\n\t\treturn v\n\t}\n\treturn defaultValue\n}\n\n// validateConfigValue\nfunc validateConfigValue(key, value string) error {\n\t// Basic length check\n\tif len(value) > 1024 {\n\t\treturn fmt.Errorf(\"configuration value too long, maximum 1024 characters\")\n\t}\n\n\tswitch key {\n\tcase \"ADMIN_USERNAME\", \"admin_username\":\n\t\t// Admin username: allowed letters, numbers, underscores, length 4-32\n\t\tif len(value) < 4 || len(value) > 32 {\n\t\t\treturn fmt.Errorf(\"admin username length must be between 4-32\")\n\t\t}\n\t\tif !public.IsValidUsername(value) {\n\t\t\treturn fmt.Errorf(\"admin username can only contain letters, numbers and underscores\")\n\t\t}\n\n\tcase \"ADMIN_PASSWORD\", \"admin_password\":\n\t\tif len(value) < 4 {\n\t\t\treturn fmt.Errorf(\"password length must be at least 4 characters\")\n\t\t}\n\n\tcase \"BILLIONMAIL_HOSTNAME\", \"billionmail_hostname\":","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/controller/settings/settings.go#L169-L205","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Shorten the value to <=1024 characters (bytes)","Move large content (HTML, JSON, attachments) to a dedicated table/file instead of a config key","Split long lists into multiple keys if the schema allows","Use len(value) in your client to check the size before submitting"],"exampleFix":"// before\nsetValue(\"SMTP_RELAY_HOSTS\", strings.Join(manyHosts, \",\")) // > 1024 chars\n// after\nsetValue(\"SMTP_RELAY_HOSTS\", strings.Join(manyHosts, \",\"))\n// ensure len(value) <= 1024, or persist in a dedicated table instead","handlingStrategy":"validation","validationCode":"function isValidConfigValue(value) {\n  return typeof value === 'string' && value.length <= 1024;\n}","typeGuard":"function isShortString(v: unknown): v is string {\n  return typeof v === 'string' && v.length <= 1024;\n}","tryCatchPattern":null,"preventionTips":["Check value length before every SetSystemConfig call","Move large blobs to dedicated storage instead of config keys","Document the 1024-char limit in your config UI","Truncate or split long values client-side"],"tags":["validation","settings","input-length"],"backgroundTag":"config-value-validation-failed","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}