plandex-ai/plandex · error
error checking custom models: %v
Error message
error checking custom models: %v
What it means
The function validates the user's custom models file via CustomModelsCheckLocalChanges and wraps any failure as 'error checking custom models: %v'. This indicates the custom models file at GetCustomModelsPath(userId) could not be read or parsed.
Source
Thrown at app/cli/lib/models_sync.go:24
"plandex-cli/term"
"github.com/fatih/color"
)
func PromptSyncModelsIfNeeded() error {
var changes []string
var onApprove []func() error
userId := auth.Current.UserId
if userId == "" {
return fmt.Errorf("auth.Current.UserId is empty")
}
customModelsPath := GetCustomModelsPath(userId)
customModelsRes, err := CustomModelsCheckLocalChanges(customModelsPath)
if err != nil {
return fmt.Errorf("error checking custom models: %v", err)
}
if customModelsRes.HasLocalChanges {
changes = append(
changes,
fmt.Sprintf("%s → %s", color.New(term.ColorHiCyan, color.Bold).Sprint("Custom models"), customModelsPath))
onApprove = append(onApprove, SyncCustomModels)
}
defaultModelSettingsRes, err := ModelSettingsCheckLocalChanges(DefaultModelSettingsPath)
if err != nil {
return fmt.Errorf("error checking default model settings: %v", err)
}
if defaultModelSettingsRes.HasLocalChanges {
changes = append(
changes,View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the custom models file at GetCustomModelsPath(userId) and fix its JSON syntax
- Restore the file from backup or delete it to regenerate defaults
- Check file permissions on the custom models path
- Check disk space / I/O health if read errors persist
Example fix
// validate before syncing
if _, err := os.Stat(customModelsPath); err == nil {
var m map[string]any
if err := json.Unmarshal(b, &m); err != nil {
// repair or reset the file before calling PromptSyncModelsIfNeeded
}
} Defensive patterns
Strategy: validation
Validate before calling
path := lib.GetCustomModelsPath(userId)
if b, err := os.ReadFile(path); err == nil {
var v any
if err := json.Unmarshal(b, &v); err != nil {
return fmt.Errorf("custom models file invalid at %s: %w", path, err)
}
} Try / catch
if err := lib.PromptSyncModelsIfNeeded(); err != nil {
if strings.Contains(err.Error(), "error checking custom models") {
// back up and reset the custom models file, then retry
}
return err
} Prevention
- Back up custom models files before manual edits
- Validate JSON with a linter before saving
- Check file permissions after syncing machines
- Keep one CLI version to avoid schema drift
When it happens
Trigger: CustomModelsCheckLocalChanges(customModelsPath) errors — file unreadable (permissions), invalid JSON, or an I/O error while comparing local changes.
Common situations: Corrupted or hand-edited custom models JSON; partially written file after a crash; wrong HOME so the per-user path resolves oddly; restrictive file permissions.
Related errors
- error checking default model settings: %v
- error checking plan model settings: %v
- error loading accounts: %v
- error getting server models input: %v
- invalid value: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/302768eaa947dbad.
Report an issue: GitHub.