{"record":{"id":"5f5fc357f726620d","repo":"stride3d/stride","slug":"the-asset-mount-point-cannot-be-renamed","errorCode":null,"errorMessage":"The asset mount point cannot be renamed","messagePattern":"The asset mount point cannot be renamed","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetMountPointViewModel.cs","lineNumber":14,"sourceCode":"// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)\n// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.\nusing System;\n\nnamespace Stride.Core.Assets.Editor.ViewModel\n{\n    public class AssetMountPointViewModel : MountPointViewModel\n    {\n        public AssetMountPointViewModel(PackageViewModel package)\n            : base(package)\n        {\n        }\n\n        public override string Name { get { return \"Assets\"; } set { throw new InvalidOperationException(\"The asset mount point cannot be renamed\"); } }\n\n        public override bool IsEditable => false;\n\n        public override bool CanDelete(out string error)\n        {\n            error = \"Unable to delete the asset root folder.\";\n            return false;\n        }\n\n        public override bool AcceptAssetType(Type assetType)\n        {\n            return !typeof(IProjectAsset).IsAssignableFrom(assetType);\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetMountPointViewModel.cs#L1-L30","documentation":"The asset mount point (the virtual 'Assets' root of a package) is a fixed node in the directory tree. Its Name setter deliberately throws InvalidOperationException because renaming the mount point would break package layout, and its IsEditable is false. This is an intentional guard against an unsupported operation.","triggerScenarios":"Assigning any value to AssetMountPointViewModel.Name, or calling rename UI/logic on the asset root node instead of on a regular directory view model.","commonSituations":"Generic rename code iterating the whole directory tree without checking IsEditable; scripts trying to rebrand the 'Assets' root folder.","solutions":["Do not rename the mount point; check IsEditable first and skip non-editable nodes.","If a different root name is required, that requires changing the package layout in the engine, not the editor view model.","Route rename operations to DirectoryViewModel instances (subdirectories) only."],"exampleFix":"// before\nnode.Name = \"MyAssets\";\n// after\nif (node.IsEditable) node.Name = \"MyAssets\";","handlingStrategy":"validation","validationCode":"if (!node.IsEditable) { logger.Info(\"Asset root cannot be renamed\"); return; }","typeGuard":"bool CanRename(DirectoryBaseViewModel n) => n.IsEditable && !(n is AssetMountPointViewModel);","tryCatchPattern":"try { node.Name = newName; }\ncatch (InvalidOperationException) { logger.Warn(\"Asset mount point cannot be renamed\"); }","preventionTips":["Check IsEditable before any rename UI action","Disable rename gestures on the tree root node","Only issue renames on regular DirectoryViewModel nodes"],"tags":["assets","rename","unsupported-operation","view-model"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}