{"record":{"id":"e942f7118f445f54","repo":"mastra-ai/mastra","slug":"invalid-agent-builder-action-actionid","errorCode":null,"errorMessage":"Invalid agent-builder action: ${actionId}","messagePattern":"Invalid agent-builder action: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"packages/server/src/server/handlers/agent-builder.ts","lineNumber":127,"sourceCode":"export const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({\n  method: 'GET',\n  path: '/agent-builder/:actionId/runs',\n  responseType: 'json',\n  pathParamSchema: actionIdPathParams,\n  queryParamSchema: listWorkflowRunsQuerySchema,\n  responseSchema: workflowRunsResponseSchema,\n  summary: 'List action runs',\n  description: 'Returns a paginated list of execution runs for the specified 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      await registerAgentBuilderWorkflows(mastra);\n\n      if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n        throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n      }\n\n      logger.info('Listing agent builder action runs', { actionId });\n\n      return await workflows.LIST_WORKFLOW_RUNS_ROUTE.handler({\n        ...ctx,\n        workflowId: actionId,\n      });\n    } catch (error) {\n      logger.error('Error listing agent builder action runs', { error, actionId });\n      return handleError(error, 'Error getting agent builder action runs');\n    } finally {\n      WorkflowRegistry.cleanup();\n    }\n  },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = createRoute({","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/agent-builder.ts#L109-L145","documentation":"The agent-builder 'list runs' handler performs the same WorkflowRegistry.isAgentBuilderWorkflow check but returns a shorter message: an HTTPException 400 with `Invalid agent-builder action: ${actionId}` when the ID is not a registered agent-builder workflow.","triggerScenarios":"GET agent-builder runs endpoint with an unknown/unregistered actionId, typically from a stale client cache, a deleted/renamed workflow, or an ID belonging to a regular (non-agent-builder) workflow.","commonSituations":"Listing runs for an action after the server was updated and the workflow was removed/renamed, client UI retaining an old selection, or querying runs of a normal workflow through the agent-builder route by mistake.","solutions":["Refresh the client so the action list is re-fetched from the current server","Use a currently registered agent-builder actionId (see the sibling 'get' endpoint's full valid list)","Verify the workflow still exists and is registered in this environment","If listing runs for a plain workflow, use the standard workflow runs endpoint instead"],"exampleFix":"// before\nLIST_WORKFLOW_RUNS_ROUTE with actionId: 'deployBuilderV1' // removed in this server\n// after\nLIST_WORKFLOW_RUNS_ROUTE with actionId: 'deploy-builder' // current registered ID","handlingStrategy":"validation","validationCode":"const isValidAgentBuilderAction = (actionId: string, registered: Set<string>) => registered.has(actionId);\nif (!isValidAgentBuilderAction(actionId, currentRegisteredActions)) {\n  // skip the list-runs call and re-fetch registry first\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await listAgentBuilderRuns(actionId);\n} catch (err) {\n  if (err instanceof HTTPException && err.status === 400) {\n    logger.warn(`Action ${actionId} no longer registered; refreshing`, { err });\n    await refreshRegistry();\n    return [];\n  }\n  throw err;\n}","preventionTips":["Re-fetch the action list whenever the server version changes","Treat 400 from list-runs as 'stale client state' and refresh","Only query agent-builder runs endpoints with agent-builder workflows, not ordinary workflows"],"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"}