plandex-ai/plandex · error
error calling model: %v
Error message
error calling model: %v
What it means
Wraps any non-context-canceled error from the model request made inside buildWholeFileFallback. If the context was canceled the raw error is returned; everything else is wrapped as 'error calling model'.
Source
Thrown at app/server/model/plan/build_whole_file.go:123
AfterReq: func() {
fileState.builderRun.BuildWholeFileFinishedAt = time.Now()
},
WillCacheNumTokens: willCacheNumTokens,
EstimatedOutputTokens: maxExpectedOutputTokens,
SessionId: sessionId,
Settings: fileState.settings,
OrgUserConfig: fileState.orgUserConfig,
})
if err != nil {
if errors.Is(err, context.Canceled) {
log.Printf("buildWholeFileFallback - context canceled during model request for file %s", filePath)
return "", err
}
return "", fmt.Errorf("error calling model: %v", err)
}
fileState.builderRun.GenerationIds = append(fileState.builderRun.GenerationIds, modelRes.GenerationId)
fileState.builderRun.BuildWholeFileFinishedAt = time.Now()
content := modelRes.Content
// log.Printf("buildWholeFile - %s - content:\n%s\n", filePath, content)
wholeFile := utils.GetXMLContent(content, "PlandexWholeFile")
if wholeFile == "" {
log.Printf("buildWholeFile - no whole file found in response\n")
return fileState.wholeFileRetryOrError(buildCtx, proposedContent, desc, comments, sessionId, fmt.Errorf("no whole file found in response"))
}
return wholeFile, nil
}View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the wrapped %v cause to identify the provider failure
- Check API key/auth vars and model pack configuration
- Retry with backoff for transient network/rate-limit errors
Defensive patterns
Strategy: retry
Validate before calling
if err := validateModelConfig(authVars, settings); err != nil {
return fmt.Errorf("model config invalid before call: %v", err)
} Try / catch
content, err := buildWholeFileFallback(...)
var ctxErr error
if errors.Is(err, context.Canceled) {
return err // do not retry cancellations
}
if strings.HasPrefix(err.Error(), "error calling model:") {
// retry with backoff for transient provider failures
} Prevention
- Check API keys and model config before requests
- Use exponential backoff for transient network/rate-limit errors
- Distinguish context.Canceled from real failures to avoid pointless retries
When it happens
Trigger: The LLM API call fails: network errors, auth failures, rate limits, invalid model config, or provider 5xx — anything except context.Canceled.
Common situations: Expired/invalid API keys, provider outages, misconfigured base model config, rate limiting during heavy usage.
Related errors
- connection to plan stream timed out due to missing heartbeat
- error listing contexts: %v
- error getting context body: %v
- error getting server models input: %v
- error fetching users: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/f9f606763e9063b3.
Report an issue: GitHub.