Relationships
#3582 dns_records lookup: distinguish no-match from API/auth/network failure (or add a list method)
Opened by randybias · 10/17/2026· Shipped 10/20/2026
Problem
dns_records lookup throws No dns records found matching filters: ... when nothing matches. It also throws (from listAll) on auth failures, network errors, and API errors. A caller (a workflow step, or another model via context.runModel()) only sees a failed method in both cases, so it cannot tell "the record does not exist yet" from "the lookup could not run".
This matters for idempotent create-or-adopt flows: the natural pattern is "lookup; if absent, create". Today that pattern either has to treat every lookup failure as absence (and then try to create a record while, say, the token is wrong), or parse the error message text.
There is also no list method on the model, so there is no non-throwing way to ask "which records match?".
Proposed solution
Either of these would solve it:
- Give
lookupan opt-in such asallowMissing: true(argument) that writes nothing and returns successfully with zero data handles (or writes a smalllookupResultresource withfound: false) when there are no matches, while still throwing on API/auth/network errors and on multiple matches. - Or add a
listmethod that applies the same filters and writes the matches (possibly zero) as resources or a single list resource, succeeding with an empty result when nothing matches.
Alternatives
Matching on the error message text works but is brittle. Calling get by id requires already knowing the id.
Upstream repository: https://github.com/swamp-club/swamp-extensions
Environment
- Extension:
@swamp/cloudflare/dns@2026.10.17.1 - swamp:
20261013.025835.0-sha.1b6f0c59 - OS:
linux(aarch64) - Deno:
2.9.7 - Shell:
/usr/bin/zsh
Shipped
Click a lifecycle step above to view its details.
system commented 10/17/2026, 1:50:54 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
stack72 commented 10/20/2026, 12:36:30 AM
Thanks @randybias for reporting this! We shipped: Add an opt-in allowMissing argument to the generated lookup method for Cloudflare, Vercel and Hetzner models. With allowMissing true, a no-match succeeds and writes a lookupResult record with found false, under a distinct lookup- prefixed data name, instead of throwing. API, auth and network errors and multiple matches still throw. A successful lookup writes state as today plus lookupResult with found true, so create-or-adopt workflows can branch with a CEL condition on data.latest. The change is made in the codegen templates and regenerated.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.