{"record":{"id":"6d74a039adb4d332","repo":"plandex-ai/plandex","slug":"error-checking-model-settings-file-v","errorCode":null,"errorMessage":"error checking model settings file: %v","messagePattern":"error checking model settings file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/model_settings.go","lineNumber":37,"sourceCode":"func init() {\n\tDefaultModelSettingsPath = filepath.Join(fs.HomePlandexDir, \"default-model-settings.json\")\n}\n\nfunc GetPlanModelSettingsPath(planId string) string {\n\treturn filepath.Join(fs.HomePlandexDir, planId, \"model-settings.json\")\n}\n\ntype ModelSettingsCheckLocalChangesResult struct {\n\tHasLocalChanges           bool\n\tLocalModelPackSchemaRoles *shared.ModelPackSchemaRoles\n}\n\nfunc ModelSettingsCheckLocalChanges(path string) (ModelSettingsCheckLocalChangesResult, error) {\n\thashPath := path + \".hash\"\n\n\texists, err := fs.FileExists(path)\n\tif err != nil {\n\t\treturn ModelSettingsCheckLocalChangesResult{}, fmt.Errorf(\"error checking model settings file: %v\", err)\n\t}\n\n\tif !exists {\n\t\treturn ModelSettingsCheckLocalChangesResult{}, nil\n\t}\n\n\tlastSavedHash, err := os.ReadFile(hashPath)\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn ModelSettingsCheckLocalChangesResult{}, fmt.Errorf(\"error reading hash file: %v\", err)\n\t}\n\n\tlocalJsonData, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn ModelSettingsCheckLocalChangesResult{}, fmt.Errorf(\"error reading JSON file: %v\", err)\n\t}\n\n\tvar clientModelPackSchemaRoles *shared.ClientModelPackSchemaRoles\n\terr = json.Unmarshal(localJsonData, &clientModelPackSchemaRoles)","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/model_settings.go#L19-L55","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: unhandled\nres, err := ModelSettingsCheckLocalChanges(settingsPath)\n// after\nres, err := ModelSettingsCheckLocalChanges(settingsPath)\nif err != nil {\n    return fmt.Errorf(\"check perms on %s and its parent dirs: %w\", settingsPath, err)\n}","handlingStrategy":"validation","validationCode":"dir := filepath.Dir(settingsPath)\nif f, err := os.Open(dir); err != nil {\n    return fmt.Errorf(\"cannot access settings dir %s: %w\", dir, err)\n} else {\n    f.Close()\n}","typeGuard":null,"tryCatchPattern":"res, err := ModelSettingsCheckLocalChanges(settingsPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"checking model settings file\") {\n        return fmt.Errorf(\"cannot stat %s — check permissions and mount health: %w\", settingsPath, err)\n    }\n    return err\n}","preventionTips":["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."],"tags":["filesystem","io","settings"],"backgroundTag":"file-access-error","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}