Significant-Gravitas/AutoGPT · error · NotFoundError

Preset #{preset_id} not found

Error message

Preset #{preset_id} not found

What it means

NotFoundError raised by update_preset_with_webhook_reconfiguration (shared by PATCH /presets/{id} and the copilot update_preset tool) when db.get_preset returns nothing for the user. It is a precondition check before any webhook re-registration or DB update runs; a missing preset aborts the whole operation before side effects.

Source

Thrown at autogpt_platform/backend/backend/api/features/library/triggers.py:128

    name: str | None = None,
    description: str | None = None,
    is_active: bool | None = None,
) -> models.LibraryAgentPreset:
    """Update a preset, re-registering its webhook if the trigger config changed.

    Shared by the ``PATCH /presets/{id}`` route and the copilot ``update_preset``
    tool. When both ``inputs`` and ``credentials`` are provided and the preset's
    graph has a webhook trigger node, the webhook is re-registered with the new
    config and the previously-attached webhook is pruned if it becomes dangling.
    Name/description/active-status changes don't touch the webhook.

    Raises:
        NotFoundError: if the preset (or, when reconfiguring, its graph) is gone.
        InvalidInputError: if the webhook backend rejects the new trigger config.
    """
    current = await db.get_preset(user_id, preset_id)
    if not current:
        raise NotFoundError(f"Preset #{preset_id} not found")

    trigger_inputs_updated, new_webhook = False, None
    if inputs is not None and credentials is not None:
        graph = await get_graph(
            current.graph_id, current.graph_version, user_id=user_id
        )
        if not graph:
            raise NotFoundError(
                f"Graph #{current.graph_id} is not accessible (anymore)"
            )
        if trigger_node := graph.webhook_input_node:
            trigger_config_with_credentials = {
                **inputs,
                **(
                    make_node_credentials_input_map(graph, credentials).get(
                        trigger_node.id
                    )
                    or {}

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. List presets and confirm the ID exists before issuing PATCH.
  2. In copilot/tool flows, re-fetch preset IDs at call time instead of trusting IDs from earlier turns.
  3. Handle NotFoundError as a terminal condition — do not retry the same ID.
  4. If concurrent deletion is expected, catch and surface 'preset was deleted by someone else'.

Example fix

# before
await update_preset_with_webhook_reconfiguration(user_id=uid, preset_id=pid, inputs=new_inputs, credentials=creds)
# after
if not await db.get_preset(uid, pid):
    raise PresetGone(pid)
await update_preset_with_webhook_reconfiguration(user_id=uid, preset_id=pid, inputs=new_inputs, credentials=creds)
Defensive patterns

Strategy: validation

Validate before calling

if not await db.get_preset(uid, pid):
    raise PresetGone(pid)

Try / catch

try:
    await update_preset_with_webhook_reconfiguration(...)
except NotFoundError:
    raise PresetGone(pid)  # terminal; do not retry same id

Prevention

When it happens

Trigger: PATCH /api/presets/{id} with a deleted preset_id; copilot tool invoked with a preset ID from a stale conversation; preset owned by a different user; concurrent delete racing the update.

Common situations: Two sessions: one deletes the preset while the other has an edit dialog open; copilot chat referencing a preset deleted turns ago; ID typo/mangling in tool arguments.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/eaf913e08bac0faa. Report an issue: GitHub.