{"record":{"id":"52fc7b0d04d637c8","repo":"stride3d/stride","slug":"this-tool-requires-a-build-path","errorCode":null,"errorMessage":"This tool requires a build path.","messagePattern":"This tool requires a build path\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.AssetCompiler/PackageBuilderOptions.cs","lineNumber":81,"sourceCode":"        /// <summary>\n        /// This function indicate if the current builder options mean to execute a slave session\n        /// </summary>\n        /// <returns>true if the options mean to execute a slave session</returns>\n        public bool IsValidForSlave()\n        {\n            return !string.IsNullOrEmpty(SlavePipe) && !string.IsNullOrEmpty(BuildDirectory);\n        }\n\n        /// <summary>\n        /// Ensure every parameter is correct for a master execution. Throw an OptionException if a parameter is wrong\n        /// </summary>\n        /// <exception cref=\"Mono.Options.OptionException\">This tool requires one input file.;filename\n        /// or\n        /// The given working directory \\ + workingDir + \\ does not exist.;workingdir</exception>\n        public void ValidateOptions()\n        {\n            if (string.IsNullOrWhiteSpace(BuildDirectory))\n                throw new ArgumentException(\"This tool requires a build path.\", \"build-path\");\n\n            try\n            {\n                BuildDirectory = Path.GetFullPath(BuildDirectory);\n            }\n            catch (Exception)\n            {\n                throw new ArgumentException(\"The provided path is not a valid path name.\", \"build-path\");\n            }\n\n            if (SlavePipe == null)\n            {\n                if (!string.IsNullOrWhiteSpace(PackageManifestFile))\n                {\n                    if (!File.Exists(PackageManifestFile))\n                        throw new ArgumentException(\"Build manifest [{0}] doesn't exist\".ToFormat(PackageManifestFile), \"packageManifestFile\");\n                }\n                else if (string.IsNullOrWhiteSpace(PackageFile))","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.AssetCompiler/PackageBuilderOptions.cs#L63-L99","documentation":"ObjectReference.SetTarget validates that the content retrieved from the candidate target node is an instance of this reference's declared type; if a non-null retrieved value has an unrelated type, it throws InvalidOperationException rather than pointing the reference at incompatible content. This protects consumers that Retrieve through the reference expecting the declared type.","triggerScenarios":"Calling SetTarget(targetNode) where targetNode.Retrieve() returns a non-null object not assignable to the reference's type — e.g. retargeting a reference to a node of a different property type, or after a refactor changed the target node's content type.","commonSituations":"Fixing broken object references (scene/asset editors) by pointing them at the wrong node; model refactors that changed a property's type while serialized references still expect the old type.","solutions":["Retarget the reference to a node whose content is assignable to the reference's type.","Validate with type.IsInstanceOfType(targetNode.Retrieve()) before calling SetTarget.","If the type legitimately changed, recreate the ObjectReference with the new type instead of retargeting."],"exampleFix":"// before\nreference.SetTarget(otherNode); // otherNode content is a different type\n// after\nvar value = otherNode.Retrieve();\nif (value == null || /* refType */ typeof(MyModel).IsInstanceOfType(value))\n    reference.SetTarget(otherNode);","handlingStrategy":"type-guard","validationCode":"var v = targetNode.Retrieve();\nif (v != null && !typeof(MyModel).IsInstanceOfType(v))\n    throw new InvalidOperationException(\"Target node content type does not match reference type\");","typeGuard":"bool IsValidTarget(ObjectReference rf, IObjectNode node) { var v = node.Retrieve(); return v == null || rf.Type.IsInstanceOfType(v); }","tryCatchPattern":"try { reference.SetTarget(candidateNode); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"does not match\")) { /* pick a node of the declared type or recreate the reference */ }","preventionTips":["Check the candidate node's content type before retargeting","Recreate references when the target property type changes","In reference-fixing UIs, filter candidate nodes by declared type"],"tags":["type-mismatch","object-reference","target-node"],"backgroundTag":"type-mismatch","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"}