vxcontrol/pentagi · error
assistant not found
Error message
assistant not found
What it means
GetFlowAssistantLog looks up an in-memory FlowAssistantLogWorker by (flowID, assistantID) in the assistantLogController's flows map. When the flow map exists but the assistantID key is absent, it returns 'assistant not found'. This means the flow is tracked but no log worker has been registered for that assistant ID.
Source
Thrown at backend/pkg/controller/aslogs.go:80
}
return flows, nil
}
func (aslc *assistantLogController) GetFlowAssistantLog(
ctx context.Context, flowID, assistantID int64,
) (FlowAssistantLogWorker, error) {
aslc.mx.Lock()
defer aslc.mx.Unlock()
flw, ok := aslc.flows[flowID]
if !ok {
return nil, fmt.Errorf("flow not found")
}
aslw, ok := flw[assistantID]
if !ok {
return nil, fmt.Errorf("assistant not found")
}
return aslw, nil
}
View on GitHub (pinned to ea665308ba)
Solutions
- Verify the assistantID actually belongs to flowID (query the DB assistants table for that flow before calling).
- Call ListFlowAssistantLogs for the flow first and pick an assistantID from the returned set.
- Ensure AddAssistant/assistant log worker registration completed before fetching its logs.
- Treat the error as not-found (HTTP 404) rather than a server fault, and refresh the client's assistant list.
Example fix
// before
aslw, err := aslc.GetFlowAssistantLog(ctx, flowID, assistantID) // panics path on unknown IDs
log.Println(aslw)
// after
logs, err := aslc.ListFlowAssistantLogs(ctx, flowID)
if err != nil { return err }
for _, l := range logs {
if l.GetAssistantID() == assistantID { return use(l) }
}
return fmt.Errorf("assistant %d not found in flow %d", assistantID, flowID) Defensive patterns
Strategy: validation
Validate before calling
logs, err := aslc.ListFlowAssistantLogs(ctx, flowID)
if err != nil { return err }
var target FlowAssistantLogWorker
for _, l := range logs {
if l.GetAssistantID() == assistantID { target = l; break }
}
if target == nil { return ErrAssistantNotFound } Type guard
func hasAssistant(logs []FlowAssistantLogWorker, id int64) bool {
for _, l := range logs { if l.GetAssistantID() == id { return true } }
return false
} Try / catch
aslw, err := aslc.GetFlowAssistantLog(ctx, flowID, assistantID)
if err != nil {
if strings.Contains(err.Error(), "not found") { return http.StatusNotFound }
return http.StatusInternalServerError
} Prevention
- Always fetch the flow's assistant log list before targeting a specific assistant ID
- Treat not-found map lookups as 404, not 500
- Refresh client-side assistant IDs after flow reloads or server restarts
When it happens
Trigger: Calling GetFlowAssistantLog with an assistantID that was never added to the flow's log map — e.g. an assistant that was never started, was deleted (map entry removed), belongs to a different flow, or the caller passes a stale/invalid assistant ID.
Common situations: A GraphQL/REST consumer requests assistant logs for an assistant created in another flow; a race where the assistant log worker registration hasn't completed yet; a client retries with an assistant ID after flow restart wiped in-memory workers.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- assistant %d not found
- flow not found
- failed to get screenshot: %w
- flow not found
- failed to get vector store log: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/5a5459e9001ac729.
Report an issue: GitHub.