vxcontrol/pentagi · error
invalid ContainerStatus: %s
Error message
invalid ContainerStatus: %s
What it means
ContainerStatus.Valid() in backend/pkg/server/models/containers.go accepts only the ContainerStatus constants (running, stopped, deleted, failed, plus the initial state defined above the excerpt). Any other value fails the GORM Validate callback with this message.
Source
Thrown at backend/pkg/server/models/containers.go:34
ContainerStatusDeleted ContainerStatus = "deleted"
ContainerStatusFailed ContainerStatus = "failed"
)
func (s ContainerStatus) String() string {
return string(s)
}
// Valid is function to control input/output data
func (s ContainerStatus) Valid() error {
switch s {
case ContainerStatusStarting,
ContainerStatusRunning,
ContainerStatusStopped,
ContainerStatusDeleted,
ContainerStatusFailed:
return nil
default:
return fmt.Errorf("invalid ContainerStatus: %s", s)
}
}
// Validate is function to use callback to control input/output data
func (s ContainerStatus) Validate(db *gorm.DB) {
if err := s.Valid(); err != nil {
db.AddError(err)
}
}
type ContainerType string
const (
ContainerTypePrimary ContainerType = "primary"
ContainerTypeSecondary ContainerType = "secondary"
)
func (t ContainerType) String() string {View on GitHub (pinned to ea665308ba)
Solutions
- Translate raw Docker states to ContainerStatus constants (e.g. exited -> stopped, dead -> failed, removing -> deleted).
- Use one of the exact ContainerStatus values defined in containers.go.
- Fix casing and whitespace in the submitted value.
- Update integrations that predate a status rename to the current constant set.
Example fix
// before
{"status": "exited"}
// after
{"status": "stopped"} Defensive patterns
Strategy: validation
Validate before calling
function dockerStatusToContainerStatus(d: string): string | null {
const map = { created: "created", running: "running", paused: "stopped", exited: "stopped", dead: "failed", removing: "deleted" };
return (map as Record<string, string>)[d] ?? null; // null means it needs manual mapping
}
const status = dockerStatusToContainerStatus(rawStatus);
if (!status) throw new Error(`unmapped docker status: ${rawStatus}`); Type guard
function isContainerStatus(v: unknown): v is "created" | "running" | "stopped" | "deleted" | "failed" {
return ["created", "running", "stopped", "deleted", "failed"].includes(v as string);
} Try / catch
try {
await api.createContainer({ name, status: rawStatus });
} catch (err) {
if (String(err).includes("invalid ContainerStatus")) {
// fall back to a safe, always-valid state after translating
await api.createContainer({ name, status: "stopped" });
} else throw err;
} Prevention
- Always translate raw Docker engine states through a mapping table before calling the API.
- Keep the mapping table next to the ContainerStatus constants and update both together.
- Log unmapped states instead of passing them through.
- Test integrations with containers that end in each Docker state.
When it happens
Trigger: Writing or filtering a sandbox container record with a status like "exited", "killed", "paused", or empty string; passing raw Docker engine status strings straight into the API.
Common situations: Mapping Docker daemon status (created/running/paused/restarting/removing/exited/dead) directly into PentAGI's model; client-side assumption of extra states; typos or casing mismatches in tool/integration code.
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
- invalid ContainerType: %s
- container path '%s' is not a directory
- invalid UsageStatsPeriod: %s
- invalid TokenStatus: %s
- invalid AssistantStatus: %s
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/c3bdc54633550dfb.
Report an issue: GitHub.