gchq/CyberChef · warning · OperationError
Not enough samples, perhaps you need to modify the sample de
Error message
Not enough samples, perhaps you need to modify the sample delimiter or add more data?
What it means
Thrown by OffsetChecker.run when the input, split by the sample delimiter, yields fewer than two samples. The operation compares characters at the same position across multiple samples; with zero or one samples there is nothing to compare, so it aborts.
Source
Thrown at src/core/operations/OffsetChecker.mjs:52
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {html}
*/
run(input, args) {
const sampleDelim = args[0],
samples = input.split(sampleDelim),
outputs = new Array(samples.length);
let i = 0,
s = 0,
match = false,
inMatch = false,
chr;
if (!samples || samples.length < 2) {
throw new OperationError("Not enough samples, perhaps you need to modify the sample delimiter or add more data?");
}
// Initialise output strings
outputs.fill("", 0, samples.length);
// Loop through each character in the first sample
for (i = 0; i < samples[0].length; i++) {
chr = samples[0][i];
match = false;
// Loop through each sample to see if the chars are the same
for (s = 1; s < samples.length; s++) {
if (samples[s][i] !== chr) {
match = false;
break;
}
match = true;
}View on GitHub (pinned to 4290ea7539)
Solutions
- Ensure the input contains at least two samples separated by the configured delimiter.
- Match the Sample delimiter argument to whatever actually separates your samples (e.g. '\n' for single newline).
- Add more data or change the delimiter so split() yields >= 2 parts.
Example fix
// before: single sample, delimiter \n\n
chef.bake("Offset Checker", ["\n\n"], "ABCDEF");
// after: two samples
chef.bake("Offset Checker", ["\n\n"], "ABCDEF\n\nABCXYZ"); Defensive patterns
Strategy: validation
Validate before calling
const sampleDelim = args[0];
if (input.split(sampleDelim).length < 2) {
// add more samples or change the delimiter
} Type guard
const hasMultipleSamples = (input, delim) => input.split(delim).length >= 2;
Try / catch
try { chef.bake("Offset Checker", [delim], input); }
catch (e) { if (e.message.startsWith("Not enough samples")) adjustDelimiter(); else throw e; } Prevention
- Match the Sample delimiter to the actual separator in your data.
- Ensure at least two samples are pasted.
- Default delimiter is '\n\n'; override for single-newline-separated data.
When it happens
Trigger: run(input, args) where input.split(args[0]).length < 2 — i.e. the sample delimiter does not occur in the input. Default delimiter is '\n\n' (double newline). A single sample with no delimiter, or an empty input, trips this.
Common situations: Forgot to paste a second sample; delimiter mismatch (samples separated by single newline but delimiter set to double); samples separated by a different character (tab, comma) than configured; input came from an operation that collapsed newlines.
Related errors
- Incorrect number of samples, perhaps you need to modify the
- Incorrect number of sets, perhaps you need to modify the sam
- Incorrect number of sets, perhaps you need to modify the sam
- Data is not a valid ${Dish.enumLookup(type)}: ${sample}
- ${this.name} cannot be empty.
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/19bcdc5b5392f824.
Report an issue: GitHub.