vxcontrol/pentagi · error
unsupported subtask status: %s
Error message
unsupported subtask status: %s
What it means
SetStatus rejects status values it does not support setting: the switch handles only the in-progress/interrupting/finished/failed family, and the default branch returns this error. The comment notes that Created cannot be set through this call — it is a guard against invalid lifecycle transitions from the worker API.
Source
Thrown at backend/pkg/controller/subtask.go:230
stw.mx.Lock()
defer stw.mx.Unlock()
switch status {
case database.SubtaskStatusRunning:
stw.completed = false
stw.waiting = false
err = stw.updater.SetStatus(ctx, database.TaskStatusRunning)
case database.SubtaskStatusWaiting:
stw.completed = false
stw.waiting = true
err = stw.updater.SetStatus(ctx, database.TaskStatusWaiting)
case database.SubtaskStatusFinished, database.SubtaskStatusFailed:
stw.completed = true
stw.waiting = false
// statuses Finished and Failed will be produced by stack from Run function call
default:
// status Created is not possible to set by this call
return fmt.Errorf("unsupported subtask status: %s", status)
}
if err != nil {
return fmt.Errorf("failed to set task status in back propagation: %w", err)
}
return nil
}
func (stw *subtaskWorker) GetResult(ctx context.Context) (string, error) {
subtask, err := stw.subtaskCtx.DB.GetSubtask(ctx, stw.subtaskCtx.SubtaskID)
if err != nil {
return "", err
}
return subtask.Result, nil
}
func (stw *subtaskWorker) SetResult(ctx context.Context, result string) error {View on GitHub (pinned to ea665308ba)
Solutions
- Only pass lifecycle statuses the API supports (e.g. processing, interrupting, finished, failed); never SubtaskStatusCreated.
- To reset a subtask, use the load/recovery path (LoadSubtaskWorker) instead of SetStatus.
- If a new status was added to database.SubtaskStatus*, extend the switch in SetStatus to handle it.
- Validate the status argument against a whitelist before calling SetStatus in orchestration code.
Example fix
// before err := stw.SetStatus(ctx, database.SubtaskStatusCreated) // unsupported // after // reset via the recovery path instead of SetStatus: worker, err := controller.LoadSubtaskWorker(ctx, taskCtx, subtask) // handles created/reset states
Defensive patterns
Strategy: validation
Validate before calling
// validate the desired status before calling SetStatus
func canSetStatus(s database.SubtaskStatus) bool {
switch s {
case database.SubtaskStatusProcessed, database.SubtaskStatusProcessing,
database.SubtaskStatusInterrupting, database.SubtaskStatusFinished,
database.SubtaskStatusFailed:
return true
}
return false // SubtaskStatusCreated is NOT settable here
} Type guard
func IsUnsupportedStatusError(err error) bool {
return strings.Contains(err.Error(), "unsupported subtask status")
} Try / catch
if !canSetStatus(desired) {
return fmt.Errorf("status %q cannot be set via SetStatus; use the load/recovery path", desired)
}
if err := stw.SetStatus(ctx, desired); err != nil {
return fmt.Errorf("set subtask status: %w", err)
} Prevention
- Never attempt to reset a subtask to 'created' through SetStatus.
- Centralize allowed transitions in one whitelist function.
- When adding a SubtaskStatus constant, extend SetStatus's switch in the same change.
- Use the LoadSubtaskWorker recovery path for state resets instead.
When it happens
Trigger: Calling SetStatus with database.SubtaskStatusCreated or any non-lifecycle status value — e.g. trying to 'reset' a subtask via SetStatus instead of the load path, or passing an invalid/typo'd status constant.
Common situations: Custom automation trying to re-run a subtask by resetting its status to created; refactoring introduced a new status constant not added to the switch; direct API misuse attempting terminal->created transitions.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- subtask %d has created yet: %w
- unexpected subtask status: %s
- flow %d has status %s: loading aborted: %w
- failed to set flow %d status: %w
- failed to update subtask %d status to created: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/07b548909ef96b38.
Report an issue: GitHub.