amir20/dozzle · error · Error
Toast id is required when once is true
Error message
Toast id is required when once is true
What it means
showToast() accepts an optional toast id; when the once option is true the id becomes mandatory, because de-duplication against existing toasts is keyed by id. If once is set without an id the function throws immediately instead of de-duplicating by undefined, which would collapse all once-toasts into one.
Solutions
- Pass a stable id on the toast object whenever using once: true, e.g. showToast({ id: "conn-lost", title: "Connection lost" }, { once: true }).
- Make the id meaningful and stable per logical event (e.g. container id + event kind) so dedup works as intended.
- If dedup is not actually needed, remove once: true instead of adding an id.
- Centralize toast creation in a helper that enforces id presence when once is requested.
Example fix
// before
showToast({ title: "Container stopped" }, { once: true }); // throws
// after
showToast({ id: "container-stopped-" + container.id, title: "Container stopped" }, { once: true }); Defensive patterns
Strategy: validation
Validate before calling
// before calling showToast with once
function showOnce(toast: { id?: string } & Record<string, unknown>, opts?: ToastOptions) {
if (opts?.once && !toast.id) throw new Error("once requires id");
showToast(toast, opts);
} Prevention
- Adopt a convention of always passing an id to showToast, then once is always safe.
- Derive ids deterministically (event kind + entity id) so dedup semantics are predictable.
- Wrap toast creation in a helper that strips once when id is missing.
- Review showToast call sites when adding once: true retroactively.
When it happens
Trigger: Calling showToast({ title: "..." }, { once: true }) with no id property on the toast object. Any caller that enables once but constructs the toast object dynamically and omits id (or passes id: undefined) triggers the throw on every call.
Common situations: Adding once: true to an existing showToast call as a quick dedup fix without adding an id; generating toasts from a loop/notify helper that drops optional fields; TypeScript not catching it because id is optional in the parameter type.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Failed to save alert
- cloud search failed
- invalid username: contains path separator or traversal
- unknown action
- user has an invalid filter
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/3957062af3f07ff2.
Report an issue: GitHub.
Appendix: source
Thrown at assets/composable/toast.ts:40
type ToastOptions = {
expire?: number;
once?: boolean;
timed?: number;
};
const toasts = ref<
{
toast: Toast;
options: ToastOptions;
}[]
>([]);
const showToast = (
toast: Omit<Toast, "id" | "createdAt"> & { id?: string },
{ expire = -1, once = false, timed }: ToastOptions = { expire: -1, once: false },
) => {
if (once && !toast.id) {
throw new Error("Toast id is required when once is true");
}
if (once && toasts.value.some((t) => t.toast.id === toast.id)) {
return;
}
const toastWithId = {
id: Date.now().toString(),
...toast,
createdAt: new Date(),
};
toasts.value.push({
toast: toastWithId,
options: { expire, once, timed },
});
if (expire > 0) {
setTimeout(() => {
removeToast(toastWithId.id);View on GitHub (pinned to d9463cbe21)