Significant-Gravitas/AutoGPT · warning · NeedConfirmation

Some webhooks linked to these credentials are still in use b

Error message

Some webhooks linked to these credentials are still in use by an agent

What it means

_remove_webhooks_by_credentials first finds all webhooks linked to the credentials being deleted. If any of them are still attached to graph nodes (triggered_nodes) or agent presets (triggered_presets) and force is False, it raises NeedConfirmation('Some webhooks linked to these credentials are still in use by an agent'). This is not an HTTP error: the router layer catches NeedConfirmation and turns it into a confirmation request (typically HTTP 409-style response asking the caller to re-send with force=true), preventing accidental removal of webhooks that live agents depend on.

Source

Thrown at autogpt_platform/backend/backend/api/features/integrations/router.py:1179

async def remove_all_webhooks_for_credentials(
    user_id: str, credentials: Credentials, force: bool = False
) -> None:
    """
    Remove and deregister all webhooks that were registered using the given credentials.

    Params:
        user_id: The ID of the user who owns the credentials and webhooks.
        credentials: The credentials for which to remove the associated webhooks.
        force: Whether to proceed if any of the webhooks are still in use.

    Raises:
        NeedConfirmation: If any of the webhooks are still in use and `force` is `False`
    """
    webhooks = await get_all_webhooks_by_creds(
        user_id, credentials.id, include_relations=True
    )
    if any(w.triggered_nodes or w.triggered_presets for w in webhooks) and not force:
        raise NeedConfirmation(
            "Some webhooks linked to these credentials are still in use by an agent"
        )
    for webhook in webhooks:
        # Unlink all nodes & presets
        for node in webhook.triggered_nodes:
            await set_node_webhook(node.id, None)
        for preset in webhook.triggered_presets:
            await set_preset_webhook(user_id, preset.id, None)

        # Prune the webhook
        webhook_manager = get_webhook_manager(ProviderName(credentials.provider))
        success = await webhook_manager.prune_webhook_if_dangling(
            user_id, webhook.id, credentials
        )
        if not success:
            logger.warning(f"Webhook #{webhook.id} failed to prune")

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Inspect the response identifying which agents/nodes use the webhooks, unlink them (edit the agent or delete it), then retry the delete.
  2. If you accept that those agents lose their trigger, re-send the request with force=true — webhooks get unlinked from nodes/presets and pruned.
  3. Audit agents via GET /integrations/webhooks (include_relations) to see triggered_nodes/triggered_presets before deleting credentials.

Example fix

# before
DELETE /integrations/github/credentials/$CRED_ID            # -> confirmation required

# after (once you accept unlinking agents)
DELETE /integrations/github/credentials/$CRED_ID?force=true
Defensive patterns

Strategy: fallback

Validate before calling

# Check usage before deleting credentials
webhooks = (await client.get("/integrations/webhooks")).json()
in_use = [w for w in webhooks if w.get("credentials_id") == cred_id
          and (w.get("triggered_nodes") or w.get("triggered_presets"))]
if in_use:
    ask_user_or_unlink(in_use)  # decide before calling DELETE

Try / catch

resp = await client.delete(f"/integrations/{provider}/credentials/{cred_id}")
if resp.status_code == 409 or "still in use" in resp.text:  # NeedConfirmation surfaced
    if user_confirmed():
        await client.delete(f"/integrations/{provider}/credentials/{cred_id}?force=true")
    else:
        unlink_and_retry()

Prevention

When it happens

Trigger: DELETE /integrations/{provider}/credentials/{id} (or the bulk variant) while an agent graph node or preset still references a webhook created with those credentials; the credentials UI deleting a connection whose webhook block is still wired into a saved agent.

Common situations: Cleaning up 'unused' credentials without checking agents; deleting a connection after a teammate built an agent on it; leftover agent presets in the library referencing old webhooks.

Related errors


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