gchq/CyberChef · error · OperationError
Error: ${err.message}
Error message
Error: ${err.message} What it means
Generic catch-all thrown by Argon2.run when the underlying argon2 computation rejects the parameters or input. Any exception from the argon2 library (bad salt, invalid memory/time/parallelism parameters, output-format mismatch, or internal hash failure) is rewrapped into OperationError with the original message preserved as 'Error: <original>'. The switch on outFormat handles successful results only, so all error paths funnel through this single catch.
Source
Thrown at src/core/operations/Argon2.mjs:111
salt,
time,
mem,
parallelism,
hashLen,
type,
});
switch (outFormat) {
case "Hex hash":
return result.hashHex;
case "Raw hash":
return Utils.arrayBufferToStr(result.hash);
case "Encoded hash":
default:
return result.encoded;
}
} catch (err) {
throw new OperationError(`Error: ${err.message}`);
}
}
}
export default Argon2;
View on GitHub (pinned to 4290ea7539)
Solutions
- Ensure salt is at least 8 bytes (use Hex or Base64 input option for a binary salt).
- Set memory cost (m) >= 8 (KiB), typically >= 16, iterations (t) >= 1, parallelism (p) >= 1.
- Read the original message after 'Error: ' in the output for the exact argon2 constraint violated.
- Match the argon2 variant (i/d/id) to the parameters you are supplying.
Example fix
// before
chef.argon2("pw", { salt: "abc", m: 4, t: 0, p: 1 });
// after - 16-byte hex salt, valid costs
chef.argon2("pw", { salt: "00112233445566778899aabbccddeeff", m: 16, t: 3, p: 1 }); Defensive patterns
Strategy: validation
Validate before calling
function assertArgon2Params({ saltBytes, m, t, p }) {
if (saltBytes.length < 8) throw new Error("salt must be >= 8 bytes");
if (!Number.isInteger(m) || m < 8) throw new Error("memory cost m must be >= 8 KiB");
if (!Number.isInteger(t) || t < 1) throw new Error("iterations t must be >= 1");
if (!Number.isInteger(p) || p < 1) throw new Error("parallelism p must be >= 1");
}
assertArgon2Params({ saltBytes: new Uint8Array(saltDecoded), m, t, p }); Type guard
function isValidArgon2Params({ m, t, p }) {
return Number.isInteger(m) && m >= 8 && Number.isInteger(t) && t >= 1 && Number.isInteger(p) && p >= 1;
} Try / catch
try {
await chef.argon2(pw, opts);
} catch (e) {
if (e.message.startsWith("Error:")) {
// argon2 library rejection; surface original reason
throw new Error(`argon2 failed: ${e.message.slice(7)}`);
}
throw e;
} Prevention
- Supply a >=8-byte binary salt via the Hex/Base64 input option.
- Keep m >= 8 (KiB), t >= 1, p >= 1.
- Match the argon2 variant to the parameters you supply.
When it happens
Trigger: Passing a salt shorter than 8 bytes (argon2 minimum), memory cost (m) below 8 KiB or not a power of two region, time/iterations (t) of 0, parallelism (p) of 0, a password/salt encoding the library cannot decode, or an unsupported outFormat combined with a library that errors during hashing.
Common situations: Recipe defaults overridden with too-small salt/memory; user lowers iterations to 0 to speed up hashing; binary salt supplied as a plain UTF-8 string that decodes to too few bytes; argon2 variant mismatch (argon2id params passed to argon2d context).
Related errors
- Error: ${err}
- Letter ${letter} is not included in LS47
- No padding requested but input is not a ${blockSize}-byte mu
- Unknown padding type: ${padding}
- Invalid PKCS#5 padding.
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/b014e7daed69bae9.
Report an issue: GitHub.