{"record":{"id":"fc4b5a906496f470","repo":"gchq/CyberChef","slug":"length-must-be-less-than-maxloremcharacters","errorCode":null,"errorMessage":"Length must be less than ${maxLoremCharacters}","messagePattern":"Length must be less than (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"warning","filePath":"src/core/operations/GenerateLoremIpsum.mjs","lineNumber":95,"sourceCode":" * @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":77,"sourceCodeEnd":102,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GenerateLoremIpsum.mjs#L77-L102","documentation":"Thrown by checkLimits() when lengthType is Bytes and length exceeds maxLoremCharacters. This caps byte-mode generation. The limit is the module-level maxLoremCharacters constant.","triggerScenarios":"Requesting more bytes of lorem ipsum than maxLoremCharacters allows.","commonSituations":"User selecting Bytes mode and entering a very large length.","solutions":["Reduce length to at most maxLoremCharacters (check the module constant for its current value).","Generate in multiple Bytes-mode passes if more output is required."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (lengthType === \"Bytes\" && length > maxLoremCharacters) {\n  // cap length to maxLoremCharacters before invoking\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the module's maxLoremCharacters constant to know the current cap.","Use a smaller byte count or batch generation."],"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"}