{"record":{"id":"715de1dd22bf1dfb","repo":"gchq/CyberChef","slug":"this-name-must-be-greater-than-or-equal-to-th","errorCode":null,"errorMessage":"${this.name} must be greater than or equal to ${this.min}.","messagePattern":"(.+?) must be greater than or equal to (.+?)\\.","errorType":"validation","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/Ingredient.mjs","lineNumber":136,"sourceCode":"            }\n            if (Array.isArray(checkVal) && checkVal.length > this.maxLength) {\n                throw new OperationError(`${this.name} length cannot exceed ${this.maxLength}.`);\n            }\n            if (checkVal instanceof Uint8Array && checkVal.length > this.maxLength) {\n                throw new OperationError(`${this.name} length cannot exceed ${this.maxLength}.`);\n            }\n        }\n\n        // 3. number checks\n        if (this.type === \"number\") {\n            if (checkVal === null || checkVal === undefined || isNaN(checkVal)) {\n                throw new OperationError(`${this.name} must be a number.`);\n            }\n            if (this.integer && !Number.isInteger(checkVal)) {\n                throw new OperationError(`${this.name} must be an integer.`);\n            }\n            if (typeof this.min === \"number\" && checkVal < this.min) {\n                throw new OperationError(`${this.name} must be greater than or equal to ${this.min}.`);\n            }\n            if (typeof this.max === \"number\" && checkVal > this.max) {\n                throw new OperationError(`${this.name} must be less than or equal to ${this.max}.`);\n            }\n        }\n\n        // 4. option checks\n        if (this.type === \"option\") {\n            if (Array.isArray(this.defaultValue)) {\n                const permittedOptions = this.defaultValue.filter(opt => {\n                    if (typeof opt !== \"string\") return false;\n                    return !opt.match(/^\\[\\/?[a-z0-9 -()^]+\\]$/i);\n                });\n                const valStr = (checkVal !== null && checkVal !== undefined) ? String(checkVal).toLowerCase() : \"\";\n                const matchedOption = permittedOptions.find(opt => opt.toLowerCase() === valStr);\n                if (!matchedOption) {\n                    throw new OperationError(`${this.name} must be one of the following: ${permittedOptions.join(\", \")}.`);\n                }","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/Ingredient.mjs#L118-L154","documentation":"Thrown by Ingredient.validate() when type is 'number', the value is a valid number, but it is below the ingredient's configured min (line 136). min is an optional numeric floor declared in the ingredient config.","triggerScenarios":"A numeric ingredient with min:N receives a value strictly less than N; e.g. a key-size ingredient with min:128 gets 64.","commonSituations":"User enters a too-small value for rounds/length/offset; a recipe built for a weaker config than the operation now enforces; slider or input clamping missing on the UI side.","solutions":["Raise the value to at least min.","If the floor is wrong, lower min in the ingredient config and re-verify the operation handles it.","Clamp the input with Math.max(min, value) before assigning."],"exampleFix":"// before - min is 128\nop.ingValues = [64];\n\n// after\nop.ingValues = [128];","handlingStrategy":"validation","validationCode":"if (typeof min === 'number' && val < min) throw new Error(`${name} < min ${min}`);","typeGuard":"function atOrAboveMin(v, min): v is number { return typeof v === 'number' && (min == null || v >= min); }","tryCatchPattern":"try { op.ingValues = [val]; } catch (e) { if (/greater than or equal to/.test(e.message)) { val = min; } }","preventionTips":["Clamp with Math.max(min, val) before assigning.","Surface min as an input bound in the UI.","Re-check min after operation config changes."],"tags":["ingredient","validation","range","number","operationerror"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}