gchq/CyberChef · error · OperationError
Width must be no more than ${MAX_WIDTH}
Error message
Width must be no more than ${MAX_WIDTH} What it means
To Hexdump caps the line width at MAX_WIDTH to keep the rendered output within practical bounds. The guard throws when the length argument exceeds that constant, after the positive-integer check has already passed.
Source
Thrown at src/core/operations/ToHexdump.mjs:70
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
const data = new Uint8Array(input);
const [length, upperCase, includeFinalLength, unixFormat] = args;
const padding = 2;
if (length < 1 || Math.round(length) !== length)
throw new OperationError("Width must be a positive integer");
if (length > MAX_WIDTH)
throw new OperationError(`Width must be no more than ${MAX_WIDTH}`);
const lines = [];
for (let i = 0; i < data.length; i += length) {
let lineNo = Utils.hex(i, 8);
const buff = data.slice(i, i+length);
const hex = [];
buff.forEach(b => hex.push(Utils.hex(b, padding)));
let hexStr = hex.join(" ").padEnd(length*(padding+1), " ");
const ascii = Utils.printable(Utils.byteArrayToChars(buff), false, unixFormat);
const asciiStr = ascii.padEnd(buff.length, " ");
if (upperCase) {
hexStr = hexStr.toUpperCase();
lineNo = lineNo.toUpperCase();
}
View on GitHub (pinned to 4290ea7539)
Solutions
- Reduce the length argument to MAX_WIDTH or below (typically use 16 or 32).
- Check the module's MAX_WIDTH constant for the exact bound.
- Split large data across multiple operations if wider rows are truly needed.
Example fix
// before: args[0] (length) = 999 (> MAX_WIDTH) -> throws // after: args[0] (length) = 16 -> within cap, passes
Defensive patterns
Strategy: validation
Validate before calling
if (length > MAX_WIDTH) {
throw new Error(`Hexdump width must be <= ${MAX_WIDTH}`);
} Type guard
const withinMaxWidth = w => Number.isInteger(w) && w >= 1 && w <= MAX_WIDTH;
Try / catch
try { toHexdump(input, [length, ...rest]); }
catch (e) { if (/no more than/.test(e.message)) { length = MAX_WIDTH; } else throw e; } Prevention
- Cap the width field at MAX_WIDTH in the UI.
- Use conventional widths (16/32) for readability.
- Read the module constant to know the exact bound.
When it happens
Trigger: Setting the length argument to a value greater than MAX_WIDTH (defined at the top of the module).
Common situations: Requesting an extremely wide row for compactness; misreading the cap; copying a config from a fork with a different MAX_WIDTH.
Related errors
- Width must be a positive integer
- Byte length must be a positive integer
- L must be non-negative
- L too large (maximum length for ${args[2]} is ${255 * HashLe
- Invalid IV length: ${iv.length} bytes TEA uses an IV length
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/ace92cc9f129cfe8.
Report an issue: GitHub.