{"record":{"id":"093e1ef9a67b5898","repo":"stride3d/stride","slug":"invalid-template-description-for-this-generator","errorCode":null,"errorMessage":"Invalid template description for this generator.","messagePattern":"Invalid template description for this generator\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Assets.Presentation/Templates/SpriteSheetFromFileTemplateGenerator.cs","lineNumber":48,"sourceCode":"        public override bool IsSupportingTemplate(TemplateDescription templateDescription)\n        {\n            return templateDescription.Id == SpriteSheetId || templateDescription.Id == UISpriteSheetId;\n        }\n\n        protected override IEnumerable<AssetItem> CreateAssets(AssetTemplateGeneratorParameters parameters)\n        {\n            var sources = parameters.Tags.Get(SourceFilesPathKey);\n            if (sources == null)\n                return base.CreateAssets(parameters);\n\n            SpriteSheetAsset asset;\n\n            if (parameters.Description.Id == SpriteSheetId)\n                asset = SpriteSheetSprite2DFactory.Create();\n            else if (parameters.Description.Id == UISpriteSheetId)\n                asset = SpriteSheetUIFactory.Create();\n            else\n                throw new ArgumentException(\"Invalid template description for this generator.\");\n\n            using (var textureTool = new TextureTool())\n            {\n                foreach (var source in sources)\n                {\n                    int width = 0;\n                    int height = 0;\n                    parameters.Logger.Verbose($\"Processing image \\\"{source}\\\"\");\n                    try\n                    {\n                        var image = textureTool.Load(source.ToString(), false);\n                        width = image.Width;\n                        height = image.Height;\n                    }\n                    catch (Exception)\n                    {\n                        parameters.Logger.Warning($\"Unable to retrieve the size of \\\"{source}\\\"\");\n                    }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Assets.Presentation/Templates/SpriteSheetFromFileTemplateGenerator.cs#L30-L66","documentation":"SpriteSheetFromFileTemplateGenerator.CreateAssets selects which factory creates the sprite sheet by matching the template description's Id against known SpriteSheet ids. Any other id means the generator was given a description it cannot handle, so it throws ArgumentException.","triggerScenarios":"Invoking this generator with a TemplateDescription whose Id is neither SpriteSheetId nor UISpriteSheetId — e.g. the template registration wires a generic sprite description to the sprite-sheet-from-file generator.","commonSituations":"Custom sprite/sprite-sheet templates mistakenly reusing this generator class; Stride version upgrades changing template ids so older descriptions no longer match.","solutions":["Register the template with the correct Id (SpriteSheetId or UISpriteSheetId) for this generator","Use the appropriate template generator class for your description's id","Update custom template ids to match the current Stride version's identifiers"],"exampleFix":"// before\nnew TemplateDescription(id: \"MySpriteSheet\", generator: typeof(SpriteSheetFromFileTemplateGenerator)); // id not recognized\n// after\nnew TemplateDescription(id: SpriteSheetFromFileTemplateGenerator.SpriteSheetId.ToString(), generator: typeof(SpriteSheetFromFileTemplateGenerator));","handlingStrategy":"validation","validationCode":"bool supported = desc.Id == SpriteSheetFromFileTemplateGenerator.SpriteSheetId\n             || desc.Id == SpriteSheetFromFileTemplateGenerator.UISpriteSheetId;\nif (!supported) throw new ArgumentException(desc.Id.ToString());","typeGuard":"bool IsSpriteSheetTemplate(TemplateDescription d) => d.Id == SpriteSheetFromFileTemplateGenerator.SpriteSheetId || d.Id == SpriteSheetFromFileTemplateGenerator.UISpriteSheetId;","tryCatchPattern":"try { foreach (var a in gen.CreateAssets(parameters)) yield return a; }\ncatch (ArgumentException) { // fall back to the generic sprite template generator\n}","preventionTips":["Register templates only with the ids their generator supports","Re-verify template ids after Stride upgrades","Keep a lookup mapping template id -> generator type to prevent miswiring"],"tags":["stride","templates","sprites"],"backgroundTag":"invalid-argument-value","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"}