Budibase/budibase · error
Operation not found
Error message
Operation not found
What it means
updateOperation resolves the agent operation via getAgentOperation (which itself validates the agent exists) and throws if the specific operationId is not found on that agent. This guards the mutation and subsequent API update against operating on a nonexistent operation.
Source
Thrown at packages/builder/src/stores/portal/agents.ts:138
private getAgentOrThrow = (agentId: string) => {
const agent = get(this.store).agents.find(
candidate => candidate._id === agentId
)
if (!agent) {
throw new Error("Agent not found")
}
return agent
}
private updateOperation = async (
agentId: string,
operationId: string,
updater: (operation: AgentOperation) => AgentOperation
) => {
const operation = this.getAgentOperation(agentId, operationId)
if (!operation) {
throw new Error("Operation not found")
}
const updated = updater(operation)
return await this.updateAgentOperation(agentId, operationId, {
name: updated.name,
live: updated.live,
promptInstructions: updated.promptInstructions,
enabledTools: updated.enabledTools,
allowKnowledgeSourceDownload: updated.allowKnowledgeSourceDownload,
})
}
private replaceAgentInStore = (updated: Agent) => {
this.update(state => {
const index = state.agents.findIndex(a => a._id === updated._id)
if (index !== -1) {
state.agents[index] = updated
}
return stateView on GitHub (pinned to a81a902e9a)
Solutions
- Verify the operationId belongs to the given agentId
- Refresh agent data before updating the operation
- Handle concurrent deletion — re-fetch and update the UI
- Check you are not passing the agent id where the operation id is expected
Example fix
// before
await agents.renameOperation(agentId, opId, "New name")
// after
const agent = get(agents).agents.find(a => a._id === agentId)
if (agent?.operations?.some(o => o.id === opId)) {
await agents.renameOperation(agentId, opId, "New name")
} Defensive patterns
Strategy: try-catch
Validate before calling
const agent = get(agents).agents.find(a => a._id === agentId)
const op = agent?.operations?.find(o => o.id === operationId)
if (!op) {
await agents.fetch()
return
} Try / catch
try {
await agents.updateOperation(agentId, operationId, updater)
} catch (e) {
if (e.message === "Operation not found") {
await agents.fetch() // resync; operation may have been deleted
} else throw e
} Prevention
- Ensure operation ids come from the same agent record you pass
- Refresh agent data after any concurrent modification
- Don't confuse agent ids with operation ids
- Handle deleted operations in the UI instead of retaining stale rows
When it happens
Trigger: Calling an operation-updating method (e.g. rename, toggle live, update prompt) with an operationId that is not present on the agent identified by agentId.
Common situations: Operation deleted concurrently in another tab; stale id after the agent's operations were replaced; mixing up ids between agents; UI list not refreshed after deletion.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Agent not found
- Workspace app not found ${workspaceAppId}
- Operation not found for this agent
- Unable to fetch datasource auth cookie
- Cannot render an empty flow chain
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/2133a00fba5241c3.
Report an issue: GitHub.