{"record":{"id":"4ee680dc86b34dfe","repo":"Significant-Gravitas/AutoGPT","slug":"graph-graph-id-is-not-accessible-anymore","errorCode":null,"errorMessage":"Graph #{graph_id} is not accessible (anymore)","messagePattern":"Graph #(.+?) is not accessible \\(anymore\\)","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/library/triggers.py","lineNumber":58,"sourceCode":"    \"\"\"Create a webhook-triggered ``LibraryAgentPreset`` for the given graph.\n\n    Sets up the webhook for the graph's trigger node — auto-registering it with\n    the provider for auto-setup webhooks, or just minting the ingress URL for\n    manual-setup webhooks — then creates a preset linked to that webhook. The\n    returned preset has ``.webhook`` populated, so ``preset.webhook.url`` is the\n    ingress URL to hand to the user for manual-setup webhooks.\n\n    Fetches the graph itself (rather than taking a ``GraphModel``) so it can run\n    as an RPC endpoint without serializing the whole graph across the boundary.\n\n    Raises:\n        NotFoundError: if the graph no longer exists / isn't accessible.\n        InvalidInputError: if the graph has no webhook node, or the webhook\n            backend rejects the trigger config / credentials.\n    \"\"\"\n    graph = await get_graph(graph_id, version=graph_version, user_id=user_id)\n    if not graph:\n        raise NotFoundError(f\"Graph #{graph_id} is not accessible (anymore)\")\n    if not (trigger_node := graph.webhook_input_node):\n        raise InvalidInputError(\n            f\"Graph #{graph_id} does not have a webhook trigger node\"\n        )\n\n    trigger_config_with_credentials = {\n        **trigger_config,\n        **(\n            make_node_credentials_input_map(graph, agent_credentials).get(\n                trigger_node.id\n            )\n            or {}\n        ),\n    }\n\n    # Resource-follows-parent: the webhook lives in the graph's org/team,\n    # not the caller's active org.\n    new_webhook, feedback = await setup_webhook_for_block(","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/library/triggers.py#L40-L76","documentation":"NotFoundError raised inside setup_triggered_preset (library/triggers.py) when get_graph(graph_id, version, user_id) returns None — the graph does not exist, is not accessible to this user, or the pinned version is gone. This is a domain exception (not an HTTPException); the API layer maps it, typically to a 404 on POST /presets/setup-trigger or PATCH /presets/{id}.","triggerScenarios":"setup-trigger RPC with a deleted graph_id; version pin referencing a pruned graph version; graph owned by a different user/org; graph soft-deleted between the user opening the trigger setup dialog and submitting it.","commonSituations":"Graph deleted in another tab while the trigger setup modal was open; stale graph_id persisted in frontend state; version mismatch after graph re-publish; cross-org access attempt.","solutions":["Confirm the graph is visible to the acting user: GET /graphs/{graph_id} with version.","Use the graph's current version rather than a cached version number.","If the graph was deleted, recreate it (or restore) before setting up the trigger.","Catch NotFoundError in RPC callers and translate it to a user-facing 'agent no longer available' message."],"exampleFix":"# before\nawait setup_triggered_preset(user_id=uid, graph_id=gid, graph_version=v, ...)\n# after\ngraph = await get_graph(gid, version=v, user_id=uid)\nif not graph:\n    raise ValueError(f\"Graph {gid} v{v} not accessible; refresh and retry\")\nawait setup_triggered_preset(user_id=uid, graph_id=gid, graph_version=graph.version, ...)","handlingStrategy":"validation","validationCode":"graph = await get_graph(gid, version=graph_version, user_id=uid)\nif not graph:\n    raise ValueError('Graph not accessible — refresh graph reference')","typeGuard":null,"tryCatchPattern":"try:\n    await setup_triggered_preset(...)\nexcept NotFoundError as e:\n    raise AgentNoLongerAvailable(str(e)) from e","preventionTips":["Fetch graph at call time; never trust graph IDs cached across long-lived sessions.","Handle version pruning: fall back to latest version if the pinned one is gone."],"tags":["not-found-error","graphs","triggers","auth-scoping"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}