{"record":{"id":"e6a94d55ddae10fe","repo":"stride3d/stride","slug":"cannot-change-an-asset-object-id-once-it-is-locked-by-a","errorCode":null,"errorMessage":"Cannot change an Asset Object Id once it is locked by a package","messagePattern":"Cannot change an Asset Object Id once it is locked by a package","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets/Asset.cs","lineNumber":60,"sourceCode":"    /// <summary>\n    /// Gets or sets the unique identifier of this asset.\n    /// </summary>\n    /// <value>The identifier.</value>\n    /// <exception cref=\"InvalidOperationException\">Cannot change an Asset Object Id once it is locked</exception>\n    [DataMember(-10000)]\n    [NonOverridable]\n    [Display(Browsable = false)]\n    public AssetId Id\n    {\n        // Note: Please keep this code in sync with Package class\n        get\n        {\n            return id;\n        }\n        set\n        {\n            if (value != id && IsIdLocked) \n                throw new InvalidOperationException(\"Cannot change an Asset Object Id once it is locked by a package\");\n\n            id = value;\n        }\n    }\n\n    // Note: Please keep this code in sync with Package class\n    /// <summary>\n    /// Gets or sets the version number for this asset, used internally when migrating assets.\n    /// </summary>\n    /// <value>The version.</value>\n    [DataMember(-8000, DataMemberMode.Assign)]\n    [DataStyle(DataStyle.Compact)]\n    [Display(Browsable = false)]\n    [DefaultValue(null)]\n    [NonOverridable]\n    [NonIdentifiableCollectionItems]\n    public Dictionary<string, PackageVersion>? SerializedVersion { get; set; }\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/Asset.cs#L42-L78","documentation":"Setter guard on Asset.Id: the asset has been added to a package, which locks its identity (IsIdLocked), and code attempted to assign a different AssetId. Asset identity is immutable once the asset belongs to a package so references stay stable.","triggerScenarios":"Thrown at sources/assets/Stride.Core.Assets/Asset.cs:60 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the asset from its package before changing the Id, then re-add it","Clone the asset into a new AssetItem if a distinct identity is required","Fix the code path that reassigns Id after package registration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}