plandex-ai/plandex · error
error checking model settings file: %v
Error message
error checking model settings file: %v
What it means
ModelSettingsCheckLocalChanges inspects the model settings file and its .hash sidecar to detect local edits. This error wraps fs.FileExists failure on the settings file itself — the function cannot even determine whether the file exists, so local-change detection is aborted.
Source
Thrown at app/cli/lib/model_settings.go:37
func init() {
DefaultModelSettingsPath = filepath.Join(fs.HomePlandexDir, "default-model-settings.json")
}
func GetPlanModelSettingsPath(planId string) string {
return filepath.Join(fs.HomePlandexDir, planId, "model-settings.json")
}
type ModelSettingsCheckLocalChangesResult struct {
HasLocalChanges bool
LocalModelPackSchemaRoles *shared.ModelPackSchemaRoles
}
func ModelSettingsCheckLocalChanges(path string) (ModelSettingsCheckLocalChangesResult, error) {
hashPath := path + ".hash"
exists, err := fs.FileExists(path)
if err != nil {
return ModelSettingsCheckLocalChangesResult{}, fmt.Errorf("error checking model settings file: %v", err)
}
if !exists {
return ModelSettingsCheckLocalChangesResult{}, nil
}
lastSavedHash, err := os.ReadFile(hashPath)
if err != nil && !os.IsNotExist(err) {
return ModelSettingsCheckLocalChangesResult{}, fmt.Errorf("error reading hash file: %v", err)
}
localJsonData, err := os.ReadFile(path)
if err != nil {
return ModelSettingsCheckLocalChangesResult{}, fmt.Errorf("error reading JSON file: %v", err)
}
var clientModelPackSchemaRoles *shared.ClientModelPackSchemaRoles
err = json.Unmarshal(localJsonData, &clientModelPackSchemaRoles)View on GitHub (pinned to e2d772072e)
Solutions
- Check permissions on the settings file and each parent directory in the reported path.
- Verify the volume backing the path is healthy and mounted.
- Pass a path the current user can stat; correct the path if it was constructed incorrectly.
Example fix
// before: unhandled
res, err := ModelSettingsCheckLocalChanges(settingsPath)
// after
res, err := ModelSettingsCheckLocalChanges(settingsPath)
if err != nil {
return fmt.Errorf("check perms on %s and its parent dirs: %w", settingsPath, err)
} Defensive patterns
Strategy: validation
Validate before calling
dir := filepath.Dir(settingsPath)
if f, err := os.Open(dir); err != nil {
return fmt.Errorf("cannot access settings dir %s: %w", dir, err)
} else {
f.Close()
} Try / catch
res, err := ModelSettingsCheckLocalChanges(settingsPath)
if err != nil {
if strings.Contains(err.Error(), "checking model settings file") {
return fmt.Errorf("cannot stat %s — check permissions and mount health: %w", settingsPath, err)
}
return err
} Prevention
- Keep the settings file and its parents readable/traversable by the CLI user.
- Avoid pointing the path at network mounts that can drop mid-run.
- Verify the constructed path doesn't include stray permission-restricted directories.
When it happens
Trigger: fs.FileExists(path) returns an error for the model settings path: permission denied on a parent directory, I/O error, or a filesystem-level failure during stat.
Common situations: The project directory or the settings file's parent was chmod'd restrictively; a network mount dropped mid-operation; path points into a directory the user can't traverse.
Related errors
- failed to read file %s: %v
- failed to open file %s: %w
- error checking if settings-v2.json exists: %v
- error creating account credentials directory: %v
- error writing account credentials: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/6d74a039adb4d332.
Report an issue: GitHub.