ErrLookup › Background articles › NotFoundError explained: what 'not found' really means when libraries throw it (and when it hides something else)
NotFoundError explained: what 'not found' really means when libraries throw it (and when it hides something else)
NotFoundError is the generic missing-resource exception raised by dozens of open-source libraries when a lookup by id, name, or path returns nothing. This article covers how the same error class behaves across litellm, Strapi, AutoGPT, Dify, RSSHub, n8n, mem0, Ghost, open-notebook and others: when it is a genuine 404, when it deliberately conceals 'no permission' or even a wrong-origin infrastructure failure, and how to debug each variant.
Distilled from 79 documented records across 14 repositories.
Background
NotFoundError sits at the application layer, not the transport layer: almost every record shows it raised after a lookup the library itself performed — a database findOne, a filtered list, a parsed scrape — returned empty. The library then synthesizes the error and, in HTTP-facing projects (AutoGPT, n8n, Dify, RSSHub, Strapi, Ghost), maps it to a 404. Crucially, no real HTTP 404 may have occurred: litellm wraps a synthetic requests.exceptions.HTTPError with an empty Response after local equality filtering of a successfully fetched model list, and RSSHub throws NotFoundError when a scraped page or API response came back empty (a YouTube channel with no uploads, an Omega Scans series with no chapters, a missing Threads LSD token). In those cases the resource was 'not found' by the library's own matching logic, not by the remote server.
A second, deliberate pattern is conflation of 'missing' with 'not yours'. AutoGPT's session, graph, and webhook validators return the identical NotFoundError when the row does not exist or exists but belongs to another user/organization; n8n's workflow-statistics gate does the same, with the warn log admitting 'User attempted to read a workflow without permissions'. mem0's login goes further, blurring a nonexistent email and a wrong password into one 401 with a dummy bcrypt verify to defeat timing-based enumeration. So a NotFoundError from these codebases means 'gone, never existed, or inaccessible to you' — the caller cannot distinguish, by design.
The family also includes genuinely degenerate cases. open-notebook's broad except in get() converts connection drops and schema-drift deserialization failures into NotFoundError, masking outages as 404s. Ghost and n8n re-throw lower-level Bookshelf NotFound and TypeORM/FolderNotFound errors as NotFoundError, and n8n's user lookup even documents an if(!user) branch that is effectively unreachable defense-in-depth behind findOneOrFail. Whether NotFoundError is a domain exception (AutoGPT's library/triggers.py, caught and mapped at the API layer) or a controller-level response varies by library, so the catch strategy is library-specific.
Across all 30 records the dominant triggers are stale identifiers — ids cached across sessions, deleted between page load and request, or created in a different environment/database — and exact-match sensitivity, whether that is litellm's case-sensitive model_name equality, RSSHub's finite COLUMNS maps, or AutoGPT's graph id/version/user triple that must match on all three components.
Common causes
- Stale or deleted identifier.The id was valid once but the row was deleted, pruned, or cancelled between fetch and use — presets, webhooks, tokens, transfer requests, sessions. The error typically fires after a precondition check aborts the operation before side effects.
- Identifier from the wrong owner or environment.The resource exists but belongs to another user/org (AutoGPT graphs, sessions, invitations) or to a different backend/database (mem0 login after a DB reset, transfers across environments). Most of these libraries deliberately return the same not-found error rather than revealing existence.
- No-permission case deliberately conflated with missing.n8n's workflow gate and AutoGPT's ownership validators map 'exists but no read scope / different owner' to the identical 404 to prevent enumeration. Check the server logs for the real reason.
- Exact-match sensitivity on names and parameters.litellm filters the fetched model list by plain string equality, so casing ('GPT-4o' vs 'gpt-4o') or surrounding whitespace makes a deployed model 'not found'. RSSHub's NWNU routes accept only column ids present in a finite COLUMNS map.
- Version or shape mismatch.AutoGPT graph lookups must match id + version + user; sending a stale version number or a name instead of a UUID fails. Ghost rejects edits when a filter excludes the row, and wrong related ids (api_key id sent as integration id) miss too.
- Resource genuinely absent or empty upstream.RSSHub throws NotFoundError when an upstream API returns an empty payload — a YouTube channel with no uploads or a terminated legacy username, an Omega Scans series with no chapters — even though the HTTP call itself succeeded.
- Infrastructure failure masked as not-found.open-notebook's broad except converts connection drops, malformed ids, and schema-drift deserialization errors into NotFoundError; during outages a spike in these errors usually indicates an outage, not missing rows.
- Missing precondition or initialization.Dify's variable reset requires a draft workflow that was never created or synced; n8n folder creation fails when the parentFolderId does not exist in the project. The operation's prerequisite is absent, not the target itself.
What usually fixes it
- Refetch before you act: resolve ids, versions, and names from a fresh list call (models.info, GET graphs, folder tree, pending transfers) at the moment of the operation instead of trusting cached values from earlier turns, pages, or notification links.
- Read the full message and logs: many variants append the underlying cause or log the real reason ('without permissions', '- {cause}' suffix in open-notebook) that distinguishes missing, forbidden, or broken infrastructure.
- Normalize and validate inputs: strip whitespace, match the system's exact casing, use only enumerated ids (COLUMNS keys, numeric API ids rather than URL slugs), and send the resource's current version, not a cached one.
- Treat 404/NotFoundError as terminal for that identifier: reconcile client state (drop the id, refresh the list) rather than retrying; for webhook ingress, configure the sender to stop retrying on 404 since the resource is gone.
- Ensure preconditions exist first: create the draft workflow, the parent folder, or the registration record before invoking the endpoint that depends on it; omit optional fields (inputs/credentials, keyid, parentFolderId) to skip lookups you do not need.
- Catch NotFoundError explicitly at the boundary and degrade gracefully — surface 'no longer available' to users, restore from published state where supported, and alert when error rates spike because it may be masking an outage.
Go deeper
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
Documented occurrences
- Model with id={model_id} not found(BerriAI/litellm)
- role.notFound(strapi/strapi)
- Webhook #{webhook_id} not found(Significant-Gravitas/AutoGPT)
- Draft workflow not found, pipeline_id={pipeline.id}(langgenius/dify)
- Graph #{current.graph_id} is not accessible (anymore)(Significant-Gravitas/AutoGPT)
- Agent #{graph_id} v{graph_version} not found for this user (#{user_id})(Significant-Gravitas/AutoGPT)
- The column ${columnParam} does not exist(DIYgod/RSSHub)
- The channel https://www.youtube.com/user/${username} does not exist.(DIYgod/RSSHub)
- Workflow ${workflowId} does not exist.(n8n-io/n8n)
- Session {session_id} not found.(Significant-Gravitas/AutoGPT)
- User not found(n8n-io/n8n)
- Resource not found: ${path}(mem0ai/mem0)
- Could not find the folder: ${folderId}(n8n-io/n8n)
- Graph #{graph_id} is not accessible (anymore)(Significant-Gravitas/AutoGPT)
- This channel doesn't have any content.(DIYgod/RSSHub)
- The column ${columnParam} does not exist(DIYgod/RSSHub)
- Object with id {id} not found - {str(e)}(lfnovo/open-notebook)
- The provided token id does not exist(strapi/strapi)
- ApiKey not found.(TryGhost/Ghost)
- Token not found(strapi/strapi)
…and 59 more across the corpus — use search.
Honest provenance: generated on 2026-08-27 from AI-assisted analysis of the linked records. See how records are made.