gchq/CyberChef · error · TypeError
flowControl operations like ${ing.opName} are not currently
Error message
flowControl operations like ${ing.opName} are not currently allowed in recipes for chef.bake in the Node API What it means
Thrown by NodeRecipe._validateIngredient when the ingredient is a function (an operation class) but its flowControl flag is set. The Node API deliberately excludes flow-control operations (Fork, Magic, etc.) from chef.bake recipes because they manipulate the recipe graph itself, which the Node execution model does not support.
Source
Thrown at src/node/NodeRecipe.mjs:48
* operation and its arguments
* @throws {TypeError} If it cannot find the operation in chef's list of operations.
*/
_validateIngredient(ing) {
// CASE operation name given. Find operation and validate
if (typeof ing === "string") {
const op = operations.find((op) => {
return sanitise(op.opName) === sanitise(ing);
});
if (op) {
// Need to validate against case 2
return this._validateIngredient(op);
} else {
throw new TypeError(`Couldn't find an operation with name '${ing}'.`);
}
// CASE operation given. Check its a chef operation and check its not flowcontrol
} else if (typeof ing === "function") {
if (ing.flowControl) {
throw new TypeError(`flowControl operations like ${ing.opName} are not currently allowed in recipes for chef.bake in the Node API`);
}
if (operations.includes(ing)) {
return ing;
} else {
throw new TypeError("Inputted function not a Chef operation.");
}
// CASE: op, maybe with configuration
} else if (ing.op) {
const sanitisedOp = this._validateIngredient(ing.op);
if (ing.args) {
return {op: sanitisedOp, args: ing.args};
}
return sanitisedOp;
} else {
throw new TypeError("Recipe can only contain function names or functions");
}
}View on GitHub (pinned to 4290ea7539)
Solutions
- Remove the flowControl operation from the Node recipe.
- Reimplement its effect with a script or a different sequence of supported operations.
- For Magic-style detection, run candidate recipes yourself instead of using the Magic op.
Example fix
// before chef.bake(input, [Fork, "From Hex"]); // Fork is flowControl // after chef.bake(input, ["From Hex"]);
Defensive patterns
Strategy: validation
Validate before calling
function assertNoFlowControl(recipe) {
for (const ing of recipe) if (typeof ing === "function" && ing.flowControl) throw new Error(`${ing.opName} is flowControl and unsupported in Node`);
} Type guard
const isFlowControl = (ing) => typeof ing === "function" && ing.flowControl === true;
Try / catch
try { chef.bake(input, recipe); } catch (e) { if (e instanceof TypeError && /flowControl operations/.test(e.message)) { /* remove op */ } else throw e; } Prevention
- Do not include Fork/Magic/Register/Label in Node recipes.
- Filter recipe builders to drop flowControl operations.
- Reimplement the needed behaviour with supported operations.
When it happens
Trigger: A recipe includes a flowControl operation passed as a function reference (e.g. chef.operations.Fork or the imported operation class). The check is ing.flowControl === true at validation time.
Common situations: Porting a browser recipe that uses Fork/Magic/Register/Label to the Node API; importing operations directly from src and adding them to a recipe array.
Related errors
- Couldn't find an operation with name '${ing}'.
- Inputted function not a Chef operation.
- Recipe can only contain function names or functions
- Sorry, the ${name} operation is not available in the Node.js
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/d3e8d33c4ef90cea.
Report an issue: GitHub.