{"record":{"id":"eaf913e08bac0faa","repo":"Significant-Gravitas/AutoGPT","slug":"preset-preset-id-not-found-eaf913","errorCode":null,"errorMessage":"Preset #{preset_id} not found","messagePattern":"Preset #(.+?) not found","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/library/triggers.py","lineNumber":128,"sourceCode":"    name: str | None = None,\n    description: str | None = None,\n    is_active: bool | None = None,\n) -> models.LibraryAgentPreset:\n    \"\"\"Update a preset, re-registering its webhook if the trigger config changed.\n\n    Shared by the ``PATCH /presets/{id}`` route and the copilot ``update_preset``\n    tool. When both ``inputs`` and ``credentials`` are provided and the preset's\n    graph has a webhook trigger node, the webhook is re-registered with the new\n    config and the previously-attached webhook is pruned if it becomes dangling.\n    Name/description/active-status changes don't touch the webhook.\n\n    Raises:\n        NotFoundError: if the preset (or, when reconfiguring, its graph) is gone.\n        InvalidInputError: if the webhook backend rejects the new trigger config.\n    \"\"\"\n    current = await db.get_preset(user_id, preset_id)\n    if not current:\n        raise NotFoundError(f\"Preset #{preset_id} not found\")\n\n    trigger_inputs_updated, new_webhook = False, None\n    if inputs is not None and credentials is not None:\n        graph = await get_graph(\n            current.graph_id, current.graph_version, user_id=user_id\n        )\n        if not graph:\n            raise NotFoundError(\n                f\"Graph #{current.graph_id} is not accessible (anymore)\"\n            )\n        if trigger_node := graph.webhook_input_node:\n            trigger_config_with_credentials = {\n                **inputs,\n                **(\n                    make_node_credentials_input_map(graph, credentials).get(\n                        trigger_node.id\n                    )\n                    or {}","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/library/triggers.py#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List presets and confirm the ID exists before issuing PATCH.","In copilot/tool flows, re-fetch preset IDs at call time instead of trusting IDs from earlier turns.","Handle NotFoundError as a terminal condition — do not retry the same ID.","If concurrent deletion is expected, catch and surface 'preset was deleted by someone else'."],"exampleFix":"# before\nawait update_preset_with_webhook_reconfiguration(user_id=uid, preset_id=pid, inputs=new_inputs, credentials=creds)\n# after\nif not await db.get_preset(uid, pid):\n    raise PresetGone(pid)\nawait update_preset_with_webhook_reconfiguration(user_id=uid, preset_id=pid, inputs=new_inputs, credentials=creds)","handlingStrategy":"validation","validationCode":"if not await db.get_preset(uid, pid):\n    raise PresetGone(pid)","typeGuard":null,"tryCatchPattern":"try:\n    await update_preset_with_webhook_reconfiguration(...)\nexcept NotFoundError:\n    raise PresetGone(pid)  # terminal; do not retry same id","preventionTips":["Re-fetch preset IDs at the moment of the update, especially in copilot/tool flows.","Treat NotFoundError on update as terminal — reconcile UI state instead of retrying."],"tags":["not-found-error","presets","webhooks","update"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}