{"record":{"id":"3b22a57de50a940f","repo":"gchq/CyberChef","slug":"length-must-be-less-than-maxloremwords","errorCode":null,"errorMessage":"Length must be less than ${maxLoremWords}","messagePattern":"Length must be less than (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"warning","filePath":"src/core/operations/GenerateLoremIpsum.mjs","lineNumber":90,"sourceCode":"export default GenerateLoremIpsum;\n\n/**\n * check combined validity of lengthType and length arguments\n * @param {string} lengthType\n * @param {number} length\n * @throws {OperationError}\n */\nfunction checkLimits(lengthType, length) {\n    if (length < 1) {\n        throw new OperationError(\"Length must be greater than 0\");\n    }\n\n    switch (lengthType) {\n        case \"Paragraphs\":\n        case \"Sentences\":\n        case \"Words\":\n            if (length > maxLoremWords) {\n                throw new OperationError(\"Length must be less than \" + maxLoremWords);\n            }\n            break;\n        case \"Bytes\":\n            if (length > maxLoremCharacters) {\n                throw new OperationError(\"Length must be less than \" + maxLoremCharacters);\n            }\n            break;\n        default:\n            throw new OperationError(\"Invalid length type\");\n    }\n}\n","sourceCodeStart":72,"sourceCodeEnd":102,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GenerateLoremIpsum.mjs#L72-L102","documentation":"Thrown by checkLimits() when lengthType is Paragraphs, Sentences, or Words and length exceeds maxLoremWords. This caps generation to prevent excessive output. The limit is a module-level constant (maxLoremWords).","triggerScenarios":"Requesting more words/sentences/paragraphs than maxLoremWords allows.","commonSituations":"User requesting a very large document, or a script defaulting to a high length value.","solutions":["Reduce length to at most maxLoremWords (check the module constant for its current value).","If more text is genuinely needed, generate in batches and concatenate."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if ([\"Paragraphs\", \"Sentences\", \"Words\"].includes(lengthType) && length > maxLoremWords) {\n  // cap length to maxLoremWords before invoking\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the module's maxLoremWords constant to know the current cap.","Clamp large requests rather than rejecting them in the UI."],"tags":["lorem-ipsum","argument-validation","limit","user-input"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}