{"record":{"id":"b4fa08ebeb235b15","repo":"files-community/Files","slug":"the-following-properties-failed-to-save-failedpr-b4fa08","errorCode":null,"errorMessage":"The following properties failed to save: {failedProperties}","messagePattern":"The following properties failed to save: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Files.App/ViewModels/Properties/Items/FileProperties.cs","lineNumber":237,"sourceCode":"\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (file.Properties is not null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tawait file.Properties.SavePropertiesAsync(newDict);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfailedProperties += $\"{prop.Name}\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!string.IsNullOrWhiteSpace(failedProperties))\n\t\t\t{\n\t\t\t\tthrow new Exception($\"The following properties failed to save: {failedProperties}\");\n\t\t\t}\n\t\t}\n\n\t\tpublic async Task ClearPropertiesAsync()\n\t\t{\n\t\t\tvar failedProperties = new List<string>();\n\t\t\tBaseStorageFile file = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileFromPathAsync(Item.ItemPath));\n\n\t\t\tif (file is null)\n\t\t\t\treturn;\n\n\t\t\tforeach (var group in ViewModel.PropertySections)\n\t\t\t{\n\t\t\t\tforeach (FileProperty prop in group)\n\t\t\t\t{\n\t\t\t\t\tif (!prop.IsReadOnly)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar newDict = new Dictionary<string, object>","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/files-community/Files/blob/68c68a58d4d6a5f7197e07c8fff85cfd4279c78b/src/Files.App/ViewModels/Properties/Items/FileProperties.cs#L219-L255","documentation":"A plain System.Exception thrown by FileProperties.SyncPropertyChangesAsync (line 237) after one or more calls to BaseStorageFile.Properties.SavePropertiesAsync threw during a single-file property save. Each failure is appended to a string as \"propertyname\" (no filename, since only one file is involved) and the aggregated list is rethrown once. The original exception is swallowed by a bare catch{} (lines 227-230), so the underlying cause — UnauthorizedAccessException, FileNotFoundException, ArgumentException for an invalid/typed value, or a missing/unregistered property handler — is not surfaced; only the property-name list survives.","triggerScenarios":"User edits one or more properties for a single file in the Details/Properties pane and applies; for at least one property the SavePropertiesAsync call at line 224 throws. Concrete causes: file is read-only or the user lacks write permission; file is open/locked by another process; the property is not backed by the file's shell property handler (e.g. System.Photo.* on a non-image); the supplied value violates the property's type/range; the file is on FAT32/exFAT/network with no NTFS property store; a OneDrive/cloud placeholder is not hydrated.","commonSituations":"Editing properties of a read-only or system file without clearing the attribute; file still open in another app (image editor, office app) holding a write lock; setting a property whose type the UI let through because the value wasn't coerced; file on a non-NTFS volume where the Windows property store is absent; property handler not registered for an uncommon extension.","solutions":["Make sure the target file is writable and not locked: clear the read-only attribute, close any app holding the file, and confirm the user has write permission on the path.","Confirm each property is applicable to the file's type and that the value matches the expected type/range; only set properties that appeared (non-read-only) in RetrieveAndInitializePropertiesAsync for this file.","For network/cloud/FAT locations, hydrate placeholders (OneDrive) or move the file to NTFS local storage before editing properties.","Use the reported property-name list to retry only the failed properties after fixing the underlying blocker.","Improve diagnostics by replacing the bare catch{} (line 227) with catch (Exception ex) that logs ex (HRESULT + type) next to the property name, so the swallowed root cause is recoverable."],"exampleFix":"// before\ntry\n{\n    if (file.Properties is not null)\n        await file.Properties.SavePropertiesAsync(newDict);\n}\ncatch\n{\n    failedProperties += $\"{prop.Name}\\n\";\n}\n\n// after\ntry\n{\n    if (file.Properties is not null)\n        await file.Properties.SavePropertiesAsync(newDict);\n}\ncatch (Exception ex)\n{\n    App.Logger?.LogWarning(ex, \"SavePropertiesAsync failed for {Prop}\", prop.Name);\n    failedProperties += $\"{prop.Name}\\n\";\n}","handlingStrategy":"try-catch","validationCode":"// Single-file gate before SavePropertiesAsync\nif (file is null || file.Properties is null) return;\n\nif (file.Attributes.HasFlag(FileAttributes.ReadOnly))\n{\n    // Prompt to clear read-only, or abort the save for this property.\n    return;\n}\n\n// Only set properties that are non-read-only for this file type\n// (already filtered by RetrieveAndInitializePropertiesAsync).","typeGuard":null,"tryCatchPattern":"// Wrap SyncPropertyChangesAsync at the call site; the message lists property names\ntry\n{\n    await fileProps.SyncPropertyChangesAsync();\n}\ncatch (Exception ex) when (ex.Message.StartsWith(\"The following properties failed to save:\"))\n{\n    // ex.Message contains one property name per line — show to user\n    // and retry once the file is unlocked / permissions are fixed.\n    await ShowPropertySaveFailuresAsync(ex.Message);\n}","preventionTips":["Clear the read-only attribute and confirm write permission on the file before editing properties.","Close any app holding a write lock on the file before applying.","Only set properties that appear non-read-only for the file's extension; do not coerce arbitrary values into typed properties.","For non-NTFS or cloud-placeholder locations, hydrate or move the file locally before editing.","Replace the bare catch{} at FileProperties.cs:227 with catch (Exception ex) that logs ex so the root cause is recoverable."],"tags":["properties","save","storage","winrt"],"backgroundTag":null,"analyzedSha":"68c68a58d4d6a5f7197e07c8fff85cfd4279c78b","analyzedAt":"2026-08-13T10:34:54.614Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}