mastra-ai/mastra · error · HTTPException
Invalid agent-builder action: ${actionId}
Error message
Invalid agent-builder action: ${actionId} What it means
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.
Source
Thrown at packages/server/src/server/handlers/agent-builder.ts:127
export const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({
method: 'GET',
path: '/agent-builder/:actionId/runs',
responseType: 'json',
pathParamSchema: actionIdPathParams,
queryParamSchema: listWorkflowRunsQuerySchema,
responseSchema: workflowRunsResponseSchema,
summary: 'List action runs',
description: 'Returns a paginated list of execution runs for the specified action',
tags: ['Agent Builder'],
requiresAuth: true,
handler: async ctx => {
const { mastra, actionId } = ctx;
const logger = mastra.getLogger();
try {
await registerAgentBuilderWorkflows(mastra);
if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {
throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });
}
logger.info('Listing agent builder action runs', { actionId });
return await workflows.LIST_WORKFLOW_RUNS_ROUTE.handler({
...ctx,
workflowId: actionId,
});
} catch (error) {
logger.error('Error listing agent builder action runs', { error, actionId });
return handleError(error, 'Error getting agent builder action runs');
} finally {
WorkflowRegistry.cleanup();
}
},
});
export const GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = createRoute({View on GitHub (pinned to 75dd419e61)
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
Example fix
// before LIST_WORKFLOW_RUNS_ROUTE with actionId: 'deployBuilderV1' // removed in this server // after LIST_WORKFLOW_RUNS_ROUTE with actionId: 'deploy-builder' // current registered ID
Defensive patterns
Strategy: validation
Validate before calling
const isValidAgentBuilderAction = (actionId: string, registered: Set<string>) => registered.has(actionId);
if (!isValidAgentBuilderAction(actionId, currentRegisteredActions)) {
// skip the list-runs call and re-fetch registry first
} Try / catch
try {
return await listAgentBuilderRuns(actionId);
} catch (err) {
if (err instanceof HTTPException && err.status === 400) {
logger.warn(`Action ${actionId} no longer registered; refreshing`, { err });
await refreshRegistry();
return [];
}
throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid agent-builder action: ${actionId}. Valid actions are
- bad request: ${responseText}
- Cannot delete the active version. Activate a different versi
- Agent ID is required
- Both threadId or resourceId must be provided
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/e942f7118f445f54.
Report an issue: GitHub.