{"record":{"id":"bddfad80f1812ac3","repo":"elastic/elasticsearch","slug":"invalid-value-must-be-one-of-true-false-limi","errorCode":null,"errorMessage":"invalid value [{}] must be one of [true,false,limited]","messagePattern":"invalid value \\[(.+?)\\] must be one of \\[true,false,limited\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java","lineNumber":274,"sourceCode":"\n        final String value;\n\n        RegexEnabled(String value) {\n            this.value = value;\n        }\n\n        /**\n         * Parse string value, necessary because `valueOf` would require strings to be upper case.\n         */\n        public static RegexEnabled parse(String value) {\n            if (TRUE.value.equals(value)) {\n                return TRUE;\n            } else if (FALSE.value.equals(value)) {\n                return FALSE;\n            } else if (LIMITED.value.equals(value)) {\n                return LIMITED;\n            }\n            throw new IllegalArgumentException(\n                \"invalid value [\" + value + \"] must be one of [\" + TRUE.value + \",\" + FALSE.value + \",\" + LIMITED.value + \"]\"\n            );\n        }\n    }\n}\n","sourceCodeStart":256,"sourceCodeEnd":280,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java#L256-L280","documentation":"CompilerSettings.RegexEnabled.parse accepts exactly three lowercase string values for 'script.painless.regex.enabled': 'true', 'false', 'limited'. Unlike enum valueOf (which needs uppercase), this parser does a manual string compare and throws IllegalArgumentException listing the allowed set for any other input, including 'TRUE', 'False', 'on', 'off', 'yes', 'no', or typos.","triggerScenarios":"Setting script.painless.regex.enabled to anything other than the literal strings 'true', 'false', or 'limited' — e.g. uppercase 'TRUE', 'enabled', '1', 'on', or a typo like 'limitted'.","commonSituations":"Porting a setting from another tool that accepts 'on'/'off' or uppercase booleans. YAML auto-conversion turning the value into a boolean type rather than the expected lowercase string. Copy-paste typos.","solutions":["Use one of the exact lowercase literals: 'true', 'false', or 'limited'.","In YAML, quote the value to prevent implicit type coercion: script.painless.regex.enabled: \"limited\".","If applying via API, ensure the JSON value is a string of one of the three allowed literals."],"exampleFix":"// before\nscript.painless.regex.enabled: TRUE\n// after\nscript.painless.regex.enabled: \"limited\"","handlingStrategy":"validation","validationCode":"function validateRegexEnabled(v) {\n  const allowed = ['true','false','limited'];\n  if (!allowed.includes(String(v).toLowerCase()) || String(v) !== String(v).toLowerCase()) {\n    throw new Error(`script.painless.regex.enabled must be one of ${allowed.join(',')} (lowercase)`);\n  }\n  return v;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always lowercase the value and quote it in YAML to avoid type coercion.","Allow-list the three literals in any config templating layer."],"tags":["painless","settings","configuration","regex","validation"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}