vxcontrol/pentagi · warning
flow not found
Error message
flow not found
What it means
GetFlowScreenshot returns the in-memory screenshot worker registered for a flow. If flowID is not present in the controller's map, it returns a plain "flow not found" error. Like the msg-log controller, this reflects runtime state only — workers exist only for currently loaded flows.
Source
Thrown at backend/pkg/controller/screenshots.go:64
func (sc *screenshotController) ListFlowsScreenshot(ctx context.Context) ([]FlowScreenshotWorker, error) {
sc.mx.Lock()
defer sc.mx.Unlock()
flows := make([]FlowScreenshotWorker, 0, len(sc.flows))
for _, flw := range sc.flows {
flows = append(flows, flw)
}
return flows, nil
}
func (sc *screenshotController) GetFlowScreenshot(ctx context.Context, flowID int64) (FlowScreenshotWorker, error) {
sc.mx.Lock()
defer sc.mx.Unlock()
flw, ok := sc.flows[flowID]
if !ok {
return nil, fmt.Errorf("flow not found")
}
return flw, nil
}
View on GitHub (pinned to ea665308ba)
Solutions
- Confirm the flow is active and the ID is correct.
- For finished flows, read screenshots from the database instead of the in-memory worker.
- Handle this as a 404-class condition at the API boundary.
- Refresh the flow list after backend restarts before issuing per-flow calls.
Example fix
null
Defensive patterns
Strategy: type-guard
Validate before calling
// confirm the flow is still active before requesting its screenshot worker
worker, err := flows.GetFlow(ctx, flowID)
if err != nil {
return err // flow already gone
} Type guard
func isFlowNotFoundError(err error) bool {
return err != nil && strings.Contains(err.Error(), "flow not found")
} Try / catch
flw, err := screenshots.GetFlowScreenshot(ctx, flowID)
if err != nil {
if isFlowNotFoundError(err) {
// fall back to DB-backed screenshot listing for finished flows
return listScreenshotsFromDB(ctx, flowID)
}
return nil, err
} Prevention
- Avoid racing flow teardown: a flow removed by FinishFlow makes this lookup fail.
- Keep a DB fallback for historical screenshots — the worker map is ephemeral.
- Refresh flow state after backend restarts; workers are not rehydrated here.
- Map this error to 404 at the API boundary.
When it happens
Trigger: Calling ScreenshotController.GetFlowScreenshot(ctx, flowID) for a flow that was never started, has finished (removed from the map on successful FinishFlow), or after a backend restart (in-memory workers are not restored here).
Common situations: Client fetching screenshots for a just-finished flow; stale flow ID cached in the frontend after restart; race between finishing a flow and a pending screenshot download; flow ID from a different environment.
Related errors
- flow not found
- flow not found
- flow not found
- assistant not found
- flow %d has status %s: loading aborted: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/4eb523179141260b.
Report an issue: GitHub.