{"record":{"id":"5975a2dd9e0c1ad0","repo":"mastra-ai/mastra","slug":"invalid-agent-builder-action-actionid-valid-a","errorCode":null,"errorMessage":"Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(', ')}","messagePattern":"Invalid agent-builder action: (.+?)\\. Valid actions are: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"packages/server/src/server/handlers/agent-builder.ts","lineNumber":92,"sourceCode":"\nexport const GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = createRoute({\n  method: 'GET',\n  path: '/agent-builder/:actionId',\n  responseType: 'json',\n  pathParamSchema: actionIdPathParams,\n  responseSchema: workflowInfoSchema,\n  summary: 'Get action by ID',\n  description: 'Returns details for a specific agent-builder action',\n  tags: ['Agent Builder'],\n  requiresAuth: true,\n  handler: async ctx => {\n    const { mastra, actionId } = ctx;\n    const logger = mastra.getLogger();\n    try {\n      const agentBuilderWorkflows = await registerAgentBuilderWorkflows(mastra);\n\n      if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n        throw new HTTPException(400, {\n          message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(', ')}`,\n        });\n      }\n\n      logger.info('Getting agent builder action by ID', { actionId });\n\n      return await workflows.GET_WORKFLOW_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId });\n    } catch (error) {\n      logger.error('Error getting agent builder action by ID', { error, actionId });\n      return handleError(error, 'Error getting agent builder action');\n    } finally {\n      WorkflowRegistry.cleanup();\n    }\n  },\n});\n\nexport const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({\n  method: 'GET',","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/agent-builder.ts#L74-L110","documentation":"The agent-builder 'get action' handler validates that the requested actionId is a registered agent-builder workflow via WorkflowRegistry.isAgentBuilderWorkflow. Unknown IDs raise HTTPException 400 listing all valid action IDs from the freshly registered workflow map.","triggerScenarios":"GET agent-builder action endpoint with an actionId that was never registered — e.g. a stale hardcoded ID in playground/client code, a typo, or the workflows failed to register (registerAgentBuilderWorkflows returned a set without that key).","commonSituations":"Client and server versions out of sync (client requests an action added in a newer server), renamed actions after a refactor, referencing a custom workflow that was never registered as an agent-builder workflow, or an environment where workflow registration partially failed.","solutions":["Use one of the listed valid action IDs from the error message","Upgrade/downgrade so client and server versions agree on available agent-builder actions","Check registerAgentBuilderWorkflows succeeded (no earlier registration errors in logs)","Correct typos in the actionId string sent by the client"],"exampleFix":"// before\nGET /api/agent-builder/actions/get-agent-builder-action?actionId=runAgent\n// after\nGET /api/agent-builder/actions/get-agent-builder-action?actionId=<valid-action-from-list>","handlingStrategy":"validation","validationCode":"// Keep the client-side action list in sync before calling the endpoint\nconst VALID_ACTIONS = new Set(Object.keys(agentBuilderWorkflows));\nfunction assertValidAction(actionId: string) {\n  if (!VALID_ACTIONS.has(actionId)) {\n    throw new Error(`Unknown agent-builder action: ${actionId}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(`/api/agent-builder/actions/get-agent-builder-action?actionId=${actionId}`);\n  if (res.status === 400) {\n    const body = await res.json();\n    logger.warn('Invalid action, refreshing registry', { body });\n    await refreshActionList();\n    return;\n  }\n  return await res.json();\n} catch (err) { logger.error(err); }","preventionTips":["Fetch the available-action list from the server instead of hardcoding IDs","Pin client and server to compatible versions","Catch 400 and re-sync the registry in UI code"],"tags":["agent-builder","http-400","validation","workflow-registry"],"backgroundTag":"invalid-action-id","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}