{"record":{"id":"8f74bde844e27a7d","repo":"nocobase/nocobase","slug":"action-action-does-not-exist","errorCode":null,"errorMessage":"${action} action does not exist","messagePattern":"(.+?) action does not exist","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"packages/core/resourcer/src/resource.ts","lineNumber":119,"sourceCode":"    if (this.except.includes(name)) {\n      throw new Error(`${name} action is not allowed`);\n    }\n    if (this.actions.has(name)) {\n      throw new Error(`${name} action already exists`);\n    }\n    const action = new Action(handler);\n    action.setName(name);\n    action.setResource(this);\n    action.middlewares.unshift(...this.middlewares);\n    this.actions.set(name, action);\n  }\n\n  getAction(action: ActionName) {\n    if (this.except.includes(action)) {\n      throw new Error(`${action} action is not allowed`);\n    }\n    if (!this.actions.has(action)) {\n      throw new Error(`${action} action does not exist`);\n    }\n    return this.actions.get(action);\n  }\n}\n\nexport default Resource;\n","sourceCodeStart":101,"sourceCodeEnd":126,"githubUrl":"https://github.com/nocobase/nocobase/blob/fa42722fefe44265490dff2c27d79e2882bce4fa/packages/core/resourcer/src/resource.ts#L101-L126","documentation":"Resource.getAction() throws when the requested action name is not registered on the resource at all (the actions Map has no such key). Every resource action must be registered via addAction (or inherited defaults) before it can be resolved.","triggerScenarios":"Resourcer.getAction(resource, actionName) with an action name never registered, e.g. calling resource.getAction('export') when only the default CRUD actions were registered, or a typo'd action name in an HTTP route like /api/users:listt.","commonSituations":"Misspelled action in client request URL, custom action registered on a different resource than requested, plugin providing the action not loaded/enabled, or calling getAction before plugin registration completes.","solutions":["Register the action: `resource.addAction(name, handler)` (or define it via the resourcer's define/registration path)","Verify the action name spelling in the request path and in the registration code","Ensure the plugin that supplies the action is enabled and loaded before the request"],"exampleFix":"// before\nconst action = resourcer.getResource('users').getAction('export'); // not registered\n// after\nresource.addAction('export', exportHandler);\nconst action = resource.getAction('export');","handlingStrategy":"try-catch","validationCode":"if (!resource.actions.has(actionName)) {\n  // register the action or return a 404 before lookup\n}","typeGuard":null,"tryCatchPattern":"try {\n  const action = resource.getAction(actionName);\n} catch (e) {\n  if (e.message.endsWith('action does not exist')) {\n    ctx.status = 404; // action missing: register it or fix the name\n  } else throw e;\n}","preventionTips":["Verify action names in request paths against registered actions","Ensure plugins supplying custom actions are enabled and loaded before requests"],"tags":["resourcer","action-lookup","missing-action"],"backgroundTag":"resource-action-not-found","analyzedSha":"fa42722fefe44265490dff2c27d79e2882bce4fa","analyzedAt":"2026-09-01T00:54:31.202Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}