{"record":{"id":"4ab4c585a24539d9","repo":"vxcontrol/pentagi","slug":"failed-to-get-flow-tool-call-log-w","errorCode":null,"errorMessage":"failed to get flow tool call log: %w","messagePattern":"failed to get flow tool call log: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/controller/flow.go","lineNumber":1245,"sourceCode":"\n\tslw, err := cnts.slc.GetFlowSearchLog(ctx, flowID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get flow search log: %w\", err)\n\t}\n\n\ttlw, err := cnts.tlc.GetFlowTermLog(ctx, flowID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get flow term log: %w\", err)\n\t}\n\n\tvslw, err := cnts.vslc.GetFlowVectorStoreLog(ctx, flowID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get flow vector store log: %w\", err)\n\t}\n\n\ttclw, err := cnts.tclc.GetFlowToolCallLog(ctx, flowID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get flow tool call log: %w\", err)\n\t}\n\n\tsw, err := cnts.sc.GetFlowScreenshot(ctx, flowID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get flow screenshot: %w\", err)\n\t}\n\n\treturn &flowProviderWorkers{\n\t\tmlw:  mlw,\n\t\talw:  alw,\n\t\tslw:  slw,\n\t\ttlw:  tlw,\n\t\tvslw: vslw,\n\t\ttclw: tclw,\n\t\tsw:   sw,\n\t}, nil\n}\n","sourceCodeStart":1227,"sourceCodeEnd":1263,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/controller/flow.go#L1227-L1263","documentation":"Wraps a failure from cnts.tclc.GetFlowToolCallLog(ctx, flowID); the tool-call log stream for the flow could not be retrieved during flowProviderWorkers assembly. Root cause preserved via %w. This is the last log fetcher before the screenshot fetch in the sequence.","triggerScenarios":"Flow log retrieval where the tool-call-log storage query for flowID returns an error (missing flow, DB failure).","commonSituations":"Tool-call tables absent due to skipped migrations; DB connection issues; querying a flow from a stale/different database.","solutions":["Inspect the wrapped error for the underlying DB cause.","Verify the flowID exists in the current DB.","Apply pending migrations so tool-call-log tables exist.","Retry transient errors; check DB health/pool metrics."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var exists bool\nerr := db.QueryRow(\"SELECT EXISTS(SELECT 1 FROM flows WHERE id=$1)\", flowID).Scan(&exists)\nif err != nil || !exists { /* abort with 404 */ }","typeGuard":"func isToolCallLogError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"failed to get flow tool call log\")\n}","tryCatchPattern":"tclw, err := cnts.tclc.GetFlowToolCallLog(ctx, flowID)\nif err != nil {\n\tif isTransient(err) { /* retry with backoff */ }\n\treturn nil, fmt.Errorf(\"failed to get flow tool call log: %w\", err)\n}","preventionTips":["Validate flowID before fetching logs.","Keep tool-call-log migrations in sync with releases.","Monitor DB health and pool metrics.","Use errors.Is/As to classify wrapped causes."],"tags":["database","tool-calls","error-wrapping"],"backgroundTag":"data-source-query-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}