amir20/dozzle · error

err.Error()

Error message

err.Error()

What it means

After the action-permission check, FindContainer resolves the host/container; any failure (unknown host, unknown container id) is returned verbatim as the 404 response body via err.Error(). The client-visible message is the underlying lookup error.

Solutions

  1. Refresh the container list and retry with the current container id
  2. Verify the host id in the URL matches an available host
  3. Check the user's label filters are not hiding the container
  4. Inspect Dozzle logs ('error while trying to find container') for the underlying cause
Defensive patterns

Strategy: fallback

Validate before calling

const exists = containers.some(c => c.id === cid && c.host === hostId);
if (!exists) throw new Error('container no longer available');

Try / catch

const res = await fetch(actionUrl, {method: 'POST'});
if (res.status === 404) {
  await refreshContainers(); // id changed; reload list and retry with new id
}

Prevention

When it happens

Trigger: Action or update request against a container id that no longer exists, a wrong host id, or a container filtered out by the user's label filters.

Common situations: Container was recreated so its id changed; UI using a stale id; wrong host in URL; user's container filter excludes the target container.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/dc7306194c0056b4. Report an issue: GitHub.

Appendix: source

Thrown at internal/web/actions.go:36

	permit := true
	if h.config.Authorization.Provider != NONE {
		user := auth.UserFromContext(r.Context())
		if user.ContainerLabels.Exists() {
			userLabels = user.ContainerLabels
		}
		permit = user.Roles.Has(auth.Actions)
	}

	if !permit {
		log.Warn().Msg("user is not permitted to perform actions on container")
		http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
		return nil, false
	}

	containerService, err := h.hostService.FindContainer(hostKey(r), id, userLabels)
	if err != nil {
		log.Error().Err(err).Msg("error while trying to find container")
		http.Error(w, err.Error(), http.StatusNotFound)
		return nil, false
	}

	return containerService, true
}

func (h *handler) containerActions(w http.ResponseWriter, r *http.Request) {
	action := chi.URLParam(r, "action")

	containerService, ok := h.findContainerWithActions(w, r)
	if !ok {
		return
	}

	parsedAction, err := container.ParseContainerAction(action)
	if err != nil {
		log.Error().Err(err).Msg("error while trying to parse action")
		http.Error(w, err.Error(), http.StatusBadRequest)

View on GitHub (pinned to d9463cbe21)