Budibase/budibase · error · Error

Automation did not have a collect block

Error message

Automation did not have a collect block

What it means

`run` in triggerAutomationRun.ts executes a chained/sub-automation and expects the target automation's final step to be a Collect block whose response supplies the returned value and status. When the triggered automation finishes without a collect block, this error is thrown because there is no meaningful result to return to the caller.

Source

Thrown at packages/server/src/automations/steps/triggerAutomationRun.ts:59

      }

      const response = await triggers.externalTrigger(
        automation,
        { fields: { ...fieldParams }, timeout },
        { getResponses: true, isTestRun }
      )

      if (triggers.isAutomationResults(response)) {
        const isSuccessStatus =
          response.status === AutomationStatus.SUCCESS ||
          response.status === AutomationStatus.STOPPED
        return {
          success: isSuccessStatus,
          value: response.steps,
          status: response.status,
        }
      } else {
        throw new Error("Automation did not have a collect block")
      }
    }
  } else {
    return {
      success: false,
      status: AutomationStatus.ERROR,
    }
  }
}

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Add a Collect block (e.g. a Query step) as the final step of the target automation.
  2. Verify in the builder that the automation selected in the 'Run automation' step ends with the collect-style block.
  3. If the child automation should not return data, change the parent to a fire-and-forget trigger rather than one that expects a response.

Example fix

// before: child automation steps = [createRow]
// after: child automation steps = [createRow, collect(query)]
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const result = await triggerAutomationRun({ automationId, fields })
  return result.value
} catch (err) {
  if (err.message === "Automation did not have a collect block") {
    throw new Error(`Target automation '${automationId}' must end with a Collect block to return data`)
  }
  throw err
}

Prevention

When it happens

Trigger: Using the 'Run automation' (triggerAutomationRun) step pointing at an automation whose last step is not a Query/Collect block; the sub-automation succeeds but returns no collectable response, so run() throws.

Common situations: Refactoring a sub-automation and deleting or moving the Collect block so it is no longer the final step; wiring a parent automation to a child that was designed as a fire-and-forget (row trigger) automation; copying an automation and truncating its steps.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/2e5367fec63b33ad. Report an issue: GitHub.