nocobase/nocobase · error
${name} action is not allowed
Error message
${name} action is not allowed What it means
Resource.addAction() throws when the action name being registered is listed in the resource's `except` array. The `except` option blacklists specific actions on a resource, so registering or re-registering one of them is forbidden by design. It prevents handlers from being attached to actions that the resource explicitly disables.
Source
Thrown at packages/core/resourcer/src/resource.ts:102
excludes = except;
} else if (only.length > 0) {
excludes = Object.keys(actions).filter((name) => !only.includes(name));
}
this.except = excludes;
this.actions = Action.toInstanceMap(_.omit(actions, excludes), this);
}
getName() {
return this.options.name;
}
getExcept() {
return this.except;
}
addAction(name: ActionName, handler: HandlerType) {
if (this.except.includes(name)) {
throw new Error(`${name} action is not allowed`);
}
if (this.actions.has(name)) {
throw new Error(`${name} action already exists`);
}
const action = new Action(handler);
action.setName(name);
action.setResource(this);
action.middlewares.unshift(...this.middlewares);
this.actions.set(name, action);
}
getAction(action: ActionName) {
if (this.except.includes(action)) {
throw new Error(`${action} action is not allowed`);
}
if (!this.actions.has(action)) {
throw new Error(`${action} action does not exist`);
}View on GitHub (pinned to fa42722fef)
Solutions
- Remove the action name from the resource's `except` option if the action should be allowed
- Skip the action in registration code when it is in `resource.getExcept()`
- Register the handler under a different custom action name not in the except list
Example fix
// before
['list', 'get', 'create', 'update', 'destroy'].forEach((name) => resource.addAction(name, handlers[name]));
// after
['list', 'get', 'create', 'update', 'destroy'].forEach((name) => {
if (!resource.getExcept().includes(name)) resource.addAction(name, handlers[name]);
}); Defensive patterns
Strategy: validation
Validate before calling
if (resource.getExcept().includes(name)) {
// skip registration or log a warning instead of calling addAction
return;
}
resource.addAction(name, handler); Prevention
- Check `resource.getExcept()` before registering actions in generic registration loops
- Centralize action registration in one module so except lists are respected consistently
When it happens
Trigger: Calling resource.addAction(name, handler) where `name` is in the resource's `except` list, e.g. a resource defined with `except: ['destroy']` and later code attempting `resource.addAction('destroy', handler)`.
Common situations: Plugins or app bootstrap code registering default/extra actions on a resource that was configured with `except` (e.g. a collection configured to disallow 'destroy' or 'import'), or generic registration loops that register all CRUD actions without checking the resource's except list.
Related errors
- ${name} action already exists
- ${action} action is not allowed
- ${action} action does not exist
- ${name} resource does not exist
- Handler must be a function!
AI-assisted analysis of nocobase/nocobase@fa42722fef (2026-09-01).
Data as JSON: /api/errors/6c58dad7ebe64dee.
Report an issue: GitHub.