discourse/discourse · error · Error
blockCondition: "validate" must be a function, got ${typeof
Error message
blockCondition: "validate" must be a function, got ${typeof validateFn}. What it means
Error "blockCondition: "validate" must be a function, got ${typeof validateFn}." thrown in discourse/discourse.
Source
Thrown at frontend/discourse/app/blocks/conditions/decorator.ts:208
`blockCondition: unknown config key(s): ${suggestions}. ` +
`Valid keys are: ${VALID_CONFIG_KEYS.join(", ")}.`
);
}
// Validate args schema at decoration time (catches schema definition errors)
if (argsSchema && typeof argsSchema === "object") {
validateConditionArgsSchema(argsSchema, type);
}
// Validate constraints schema at decoration time
if (constraints) {
// Constraints reference args schema - validate they're compatible
validateConstraintsSchema(constraints, argsSchema, `Condition "${type}"`);
}
// Validate that validate is a function if provided
if (validateFn !== undefined && typeof validateFn !== "function") {
throw new Error(
`blockCondition: "validate" must be a function, got ${typeof validateFn}.`
);
}
// Freeze schema and compute derived validArgKeys
const frozenSchema: Readonly<Record<string, ArgSchema>> = Object.freeze({
...argsSchema,
});
const frozenConstraints: Readonly<BlockConstraints> | undefined = constraints
? Object.freeze({ ...constraints })
: undefined;
const argKeys: readonly string[] = Object.freeze(Object.keys(argsSchema));
const allKeys: readonly string[] =
sourceType !== "none" ? Object.freeze([...argKeys, "source"]) : argKeys;
return (TargetClass) => {
// Validate that the class extends BlockCondition
if (!(TargetClass.prototype instanceof BlockCondition)) {View on GitHub (pinned to 1b2d7253e8)
When it happens
Trigger: Thrown at frontend/discourse/app/blocks/conditions/decorator.ts:208 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26).
Data as JSON: /api/errors/619752d12bf344e5.
Report an issue: GitHub.