vxcontrol/pentagi · error
failed to create flow search log: %w
Error message
failed to create flow search log: %w
What it means
Third step of newFlowProviderWorkers: the search log worker is created via cnts.slc.NewFlowSearchLog(ctx, flowID, pub). Failure is wrapped with this message and aborts flow startup — the platform refuses to run a flow that cannot record web-search tool results.
Source
Thrown at backend/pkg/controller/flow.go:1179
func newFlowProviderWorkers(
ctx context.Context,
flowID int64,
cnts *flowProviderControllers,
pub subscriptions.FlowPublisher,
) (*flowProviderWorkers, error) {
alw, err := cnts.alc.NewFlowAgentLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow agent log: %w", err)
}
mlw, err := cnts.mlc.NewFlowMsgLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow msg log: %w", err)
}
slw, err := cnts.slc.NewFlowSearchLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow search log: %w", err)
}
tlw, err := cnts.tlc.NewFlowTermLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow term log: %w", err)
}
vslw, err := cnts.vslc.NewFlowVectorStoreLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow vector store log: %w", err)
}
tclw, err := cnts.tclc.NewFlowToolCallLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow tool call log: %w", err)
}
sw, err := cnts.sc.NewFlowScreenshot(ctx, flowID, pub)View on GitHub (pinned to ea665308ba)
Solutions
- Inspect the wrapped error and Postgres logs for the failing statement
- Verify search_logs schema exists (run goose migrations)
- Confirm DB connectivity, then retry flow creation
- Check whether the flow row was deleted concurrently
Example fix
// before: opaque wrap without flow context
slw, err := cnts.slc.NewFlowSearchLog(ctx, flowID, pub)
if err != nil { return nil, fmt.Errorf("failed to create flow search log: %w", err) }
// after: include flowID and require migrations up-to-date beforehand
if err := migrationsUpToDate(ctx, db); err != nil { return nil, err }
slw, err := cnts.slc.NewFlowSearchLog(ctx, flowID, pub)
if err != nil {
return nil, fmt.Errorf("failed to create flow search log (flow=%d): %w", flowID, err)
} Defensive patterns
Strategy: retry
Validate before calling
var t int
if err := db.QueryRowContext(ctx, `SELECT COUNT(1) FROM information_schema.tables WHERE table_name='search_logs'`).Scan(&t); err != nil || t == 0 {
return errors.New("search_logs table missing: run migrations")
} Type guard
func hasValidFlowID(flowID int64) bool { return flowID > 0 } Try / catch
slw, err := cnts.slc.NewFlowSearchLog(ctx, flowID, pub)
if err != nil {
if isTransientDBError(err) { /* retry with backoff */ }
return nil, fmt.Errorf("failed to create flow search log (flow=%d): %w", flowID, err)
} Prevention
- Never skip migrations when upgrading
- Monitor search_logs table size/locks
- Check for concurrent flow deletion before worker creation
- Give each startup step a fresh deadline to avoid inherited timeouts
When it happens
Trigger: NewFlowSearchLog fails during flow startup: DB error on the search-log storage for this flow, invalid/deleted flowID, or context cancelled by the time this step runs.
Common situations: Postgres outage or pool exhaustion mid-startup; search_logs table locked or missing (skipped migration); flow deleted between earlier worker-creation steps; long transaction backlog causing ctx deadline.
Related errors
- failed to create flow agent log: %w
- failed to create flow msg log: %w
- failed to create flow term log: %w
- failed to create flow vector store log: %w
- failed to create flow tool call log: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/c20aa2792811f0a0.
Report an issue: GitHub.