Affected Component
Other (please specify in the description)
Backend / Flow Controller
Describe the bug
When a model provider is renamed (e.g. Ollama cloud GLM -> OllamaC GLM), all flows that were created with the old provider name fail to load at service startup. The LoadFlowWorker function in pkg/controller/flow.go calls fwc.provs.LoadFlowProvider(), which returns an error because the provider name no longer exists. The flow is skipped and never added to the fc.flows in-memory map (pkg/controller/flows.go).
As a result, any subsequent GraphQL mutation or REST API call that looks up the flow in the in-memory map - finishFlow, stopFlow, putUserInput, callAssistant, PUT /flows/{id} with action: finish - returns ErrFlowNotFound ("flow not found"), even though the flow exists in the database with status waiting.
The flow is therefore permanently stuck: it cannot be finished, stopped, or resumed through the UI or API. Its Docker container keeps running as an orphan.
Expected behavior:
- Flows with a missing/renamed provider should still be loadable so they can be finished, deleted, or have their provider updated.
- Alternatively,
FinishFlow (and similar mutations) should fall back to loading the flow from DB when it is not found in the in-memory map, so users can at least clean up stuck flows.
- At minimum, the error message should distinguish between "flow does not exist in DB" and "flow exists but failed to load" to aid debugging.
Actual behavior:
finishFlow returns "flow not found" for flows that exist in DB but are not in the in-memory map due to a provider name mismatch.
PUT /flows/{id} with action: finish returns HTTP 500 "internal server error".
- The UI "Finish" button appears to do nothing (error is swallowed or shown as generic failure).
Steps to Reproduce
- Create several flows using a provider named
Ollama cloud GLM.
- Rename or delete that provider (e.g. rename to
OllamaC GLM).
- Restart the PentAGI service.
- Observe the startup logs:
failed to load flow X: failed to get flow provider: provider 'Ollama cloud GLM' not found for each affected flow.
- In the UI, click "Finish" on any of the affected flows (e.g. flow ID 85).
- The GraphQL mutation
finishFlow returns: {"errors":[{"message":"flow not found","path":["finishFlow"]}],"data":null}.
- The REST API
PUT /flows/85 with {"action":"finish"} returns: {"code":"Internal","msg":"internal server error","status":"error"}.
Root cause analysis (from source code):
In pkg/controller/flows.go, FinishFlow() looks up the flow in fc.flows map:
func (fc *flowController) FinishFlow(ctx context.Context, flowID int64) error {
fc.mx.Lock()
defer fc.mx.Unlock()
flow, ok := fc.flows[flowID]
if !ok {
return ErrFlowNotFound // ← fails here because flow was never loaded
}
// ...
}
In pkg/controller/flow.go, LoadFlowWorker() fails when the provider is missing:
// LoadFlowWorker only loads flows with status Running or Waiting
// It calls fwc.provs.LoadFlowProvider() which fails if the provider name
// stored in DB no longer matches any configured provider.
In pkg/controller/flows.go, LoadFlows() silently skips failed flows:
for _, flow := range flows {
fw, err := LoadFlowWorker(ctx, flow, ...)
if err != nil {
if errors.Is(err, ErrNothingToLoad) {
continue
}
logrus.WithContext(ctx).WithError(err).Errorf("failed to load flow %d", flow.ID)
continue // ← flow is skipped, never added to fc.flows map
}
fc.flows[flow.ID] = fw
}
Affected flows in our instance: 15 flows (IDs: 56, 58, 59, 60, 61, 65, 66, 78, 82, 83, 84, 85, 87) are stuck with two missing providers:
Ollama cloud GLM (12 flows) — renamed to OllamaC GLM
Ollama cloud deepseek (1 flow, ID 56) — provider removed entirely
Workaround: Manually updating the model_provider_name column in the flows database table to match an existing provider name, then restarting the service, allows the flows to load and be finished normally.
System Configuration
- PentAGI Version: v2.1.0-879e87c (image
vxcontrol/pentagi:latest)
- Deployment Type: Docker Compose
- Model Providers: 5 configured (including renamed providers:
OllamaC GLM formerly Ollama cloud GLM, OllamaC DS formerly Ollama cloud deepseek)
- Database: PostgreSQL with pgvector
- Instance stats: 27 flows, 24 tasks, 136 subtasks, 18 assistants
Logs and Artifacts
Docker logs (docker logs pentagi) at startup show:
time="..." level=error msg="failed to load flow 85: failed to get flow provider: provider 'Ollama cloud GLM' not found"
time="..." level=error msg="failed to load flow 84: failed to get flow provider: provider 'Ollama cloud GLM' not found"
time="..." level=error msg="failed to load flow 83: failed to get flow provider: provider 'Ollama cloud GLM' not found"
time="..." level=error msg="failed to load flow 56: failed to get flow provider: provider 'Ollama cloud deepseek' not found"
(repeated for each affected flow ID: 56, 58, 59, 60, 61, 65, 66, 78, 82, 83, 84, 85, 87)
GraphQL response from finishFlow mutation:
{"errors":[{"message":"flow not found","path":["finishFlow"]}],"data":null}
REST API response from PUT /flows/85 with {"action":"finish"}:
{"code":"Internal","msg":"internal server error","status":"error"}
Screenshots or Recordings
No response
Verification
Affected Component
Other (please specify in the description)
Backend / Flow Controller
Describe the bug
When a model provider is renamed (e.g.
Ollama cloud GLM->OllamaC GLM), all flows that were created with the old provider name fail to load at service startup. TheLoadFlowWorkerfunction inpkg/controller/flow.gocallsfwc.provs.LoadFlowProvider(), which returns an error because the provider name no longer exists. The flow is skipped and never added to thefc.flowsin-memory map (pkg/controller/flows.go).As a result, any subsequent GraphQL mutation or REST API call that looks up the flow in the in-memory map -
finishFlow,stopFlow,putUserInput,callAssistant,PUT /flows/{id}withaction: finish- returnsErrFlowNotFound("flow not found"), even though the flow exists in the database with statuswaiting.The flow is therefore permanently stuck: it cannot be finished, stopped, or resumed through the UI or API. Its Docker container keeps running as an orphan.
Expected behavior:
FinishFlow(and similar mutations) should fall back to loading the flow from DB when it is not found in the in-memory map, so users can at least clean up stuck flows.Actual behavior:
finishFlowreturns"flow not found"for flows that exist in DB but are not in the in-memory map due to a provider name mismatch.PUT /flows/{id}withaction: finishreturns HTTP 500"internal server error".Steps to Reproduce
Ollama cloud GLM.OllamaC GLM).failed to load flow X: failed to get flow provider: provider 'Ollama cloud GLM' not foundfor each affected flow.finishFlowreturns:{"errors":[{"message":"flow not found","path":["finishFlow"]}],"data":null}.PUT /flows/85with{"action":"finish"}returns:{"code":"Internal","msg":"internal server error","status":"error"}.Root cause analysis (from source code):
In
pkg/controller/flows.go,FinishFlow()looks up the flow infc.flowsmap:In
pkg/controller/flow.go,LoadFlowWorker()fails when the provider is missing:In
pkg/controller/flows.go,LoadFlows()silently skips failed flows:Affected flows in our instance: 15 flows (IDs: 56, 58, 59, 60, 61, 65, 66, 78, 82, 83, 84, 85, 87) are stuck with two missing providers:
Ollama cloud GLM(12 flows) — renamed toOllamaC GLMOllama cloud deepseek(1 flow, ID 56) — provider removed entirelyWorkaround: Manually updating the
model_provider_namecolumn in theflowsdatabase table to match an existing provider name, then restarting the service, allows the flows to load and be finished normally.System Configuration
vxcontrol/pentagi:latest)OllamaC GLMformerlyOllama cloud GLM,OllamaC DSformerlyOllama cloud deepseek)Logs and Artifacts
Docker logs (
docker logs pentagi) at startup show:GraphQL response from
finishFlowmutation:REST API response from
PUT /flows/85with{"action":"finish"}:Screenshots or Recordings
No response
Verification