{"record":{"id":"c4b0d209a8488ecf","repo":"stride3d/stride","slug":"tag-prefix-must-not-be-empty","errorCode":null,"errorMessage":"Tag prefix must not be empty.","messagePattern":"Tag prefix must not be empty\\.","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Tokens/TagDirective.cs","lineNumber":108,"sourceCode":"        /// <param name=\"end\">The end position of the token.</param>\n        public TagDirective(string handle, string prefix, Mark start, Mark end)\n            : base(start, end)\n        {\n            if (string.IsNullOrEmpty(handle))\n            {\n                throw new ArgumentNullException(\"handle\", \"Tag handle must not be empty.\");\n            }\n\n            if (!tagHandleValidator.IsMatch(handle))\n            {\n                throw new ArgumentException(\"Tag handle must start and end with '!' and contain alphanumerical characters only.\", \"handle\");\n            }\n\n            this.handle = handle;\n\n            if (string.IsNullOrEmpty(prefix))\n            {\n                throw new ArgumentNullException(\"prefix\", \"Tag prefix must not be empty.\");\n            }\n\n            this.prefix = prefix;\n        }\n\n        /// <summary>\n        /// Determines whether the specified System.Object is equal to the current System.Object.\n        /// </summary>\n        /// <param name=\"obj\">The System.Object to compare with the current System.Object.</param>\n        /// <returns>\n        /// true if the specified System.Object is equal to the current System.Object; otherwise, false.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            TagDirective other = obj as TagDirective;\n            return other != null && handle.Equals(other.handle) && prefix.Equals(other.prefix);\n        }\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Tokens/TagDirective.cs#L90-L126","documentation":"TagDirective's constructor throws ArgumentNullException when the %TAG directive prefix is null or empty. The prefix is the replacement string applied to the handle (a tag URI), and an empty prefix leaves shorthand tags unresolvable, so it is rejected at token construction.","triggerScenarios":"Parsing a %TAG directive with an empty prefix (e.g. `%TAG !e! ` with nothing after the handle), or constructing TagDirective directly with null/empty prefix.","commonSituations":"Truncated or hand-edited YAML config files; template expansion that left the tag URI blank; copy-paste of %TAG lines with the URI accidentally deleted.","solutions":["Supply a non-empty tag URI after the handle, e.g. `%TAG !e! tag:example.com,2000:`.","Validate `!string.IsNullOrEmpty(prefix)` before constructing TagDirective programmatically.","Remove the %TAG directive entirely if no tag shorthand is needed."],"exampleFix":"// before (YAML)\n%TAG !e!\n// after (YAML)\n%TAG !e! tag:example.com,2000:","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(prefix))\n    throw new ArgumentException(\"%TAG directive requires a non-empty tag URI prefix.\");\nvar token = new TagDirective(handle, prefix, start, end);","typeGuard":"static bool IsValidTagPrefix(string p) => !string.IsNullOrEmpty(p);","tryCatchPattern":"try { return new TagDirective(handle, prefix, start, end); }\ncatch (ArgumentNullException ex) { throw new YamlSyntaxException($\"%TAG directive is missing its tag URI: {ex.Message}\", start); }","preventionTips":["Always emit both handle and URI in %TAG directives, e.g. `%TAG !e! tag:example.com,2000:`.","Check templates/generators that interpolate tag URIs for empty results.","Validate full YAML documents with a parser before committing config changes."],"tags":["yaml","null-argument","directive"],"backgroundTag":"empty-required-field","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"}