amir20/dozzle · error

unknown action

Error message

unknown action: %s

What it means

ParseContainerAction validates an action string against the fixed set Start, Stop, Restart, Remove. Any other string is rejected with 'unknown action', preventing arbitrary strings from reaching the container lifecycle endpoints.

Solutions

  1. Use one of the supported actions exactly: start, stop, restart, remove
  2. Lowercase the input and trim whitespace before sending
  3. Map unsupported verbs (pause/kill) to the closest supported action in your client

Example fix

// before
ParseContainerAction("Pause")
// after
ParseContainerAction("stop") // one of start|stop|restart|remove
Defensive patterns

Strategy: validation

Validate before calling

validActions := map[string]bool{"start":true,"stop":true,"restart":true,"remove":true}
if !validActions[strings.ToLower(strings.TrimSpace(input))] { /* reject early */ }

Try / catch

action, err := ParseContainerAction(input)
if err != nil {
  // return 400 with supported actions list
}

Prevention

When it happens

Trigger: containerActions handler parses a user-supplied action string from an HTTP request (e.g. POST actions/{action}) that is not exactly 'start', 'stop', 'restart', or 'remove' (case-sensitive).

Common situations: Typos like 'restrt' or 'kill'; capitalized 'Start' from a UI or script; unsupported verbs like 'pause' or 'unpause' which Dozzle does not implement; URL-encoding or whitespace issues.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at internal/container/types.go:288

	Message string `json:"m"`
}

type ContainerAction string

const (
	Start   ContainerAction = "start"
	Stop    ContainerAction = "stop"
	Restart ContainerAction = "restart"
	Remove  ContainerAction = "remove"
)

func ParseContainerAction(input string) (ContainerAction, error) {
	action := ContainerAction(input)
	switch action {
	case Start, Stop, Restart, Remove:
		return action, nil
	default:
		return "", fmt.Errorf("unknown action: %s", input)
	}
}

type UpdateProgress struct {
	Status  string `json:"status"`  // "pulling", "recreating", "done", "error", "up-to-date"
	Layer   string `json:"layer"`   // Docker layer ID (pull events only)
	Current int64  `json:"current"` // Bytes downloaded
	Total   int64  `json:"total"`   // Total bytes for layer
	Error   string `json:"error"`   // Only when Status="error"
}

type LogEvent struct {
	Type        LogType `json:"t,omitempty"`
	Message     any     `json:"m,omitempty"`
	RawMessage  string  `json:"rm,omitempty"`
	Timestamp   int64   `json:"ts"`
	Id          uint32  `json:"id,omitempty"`
	Level       string  `json:"l,omitempty"`

View on GitHub (pinned to d9463cbe21)