stride3d/stride · error · ArgumentException

The provided path is not a valid path name.

Error message

The provided path is not a valid path name.

What it means

PackageBuilderOptions.ValidateOptions throws this ArgumentException when Path.GetFullPath(BuildDirectory) fails, which happens only when the BuildDirectory string is not a syntactically valid path (e.g. contains invalid characters or is malformed). It is a fail-fast guard so the build tool never runs with a broken output directory. The ArgumentException parameter name 'build-path' identifies the offending CLI option.

Solutions

  1. Print and inspect the --build-path value actually received by the tool; fix quoting or variable expansion in the invoking script
  2. Remove illegal filesystem characters from the path or provide a simpler absolute path
  3. Omit --build-path if the tool supports a default so a valid default is used
  4. Wrap validation: call Path.GetFullPath on the value yourself before invoking the tool to get a clearer error

Example fix

// before
--build-path="out|put"
// after
--build-path="C:\build\output"
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrWhiteSpace(buildDirectory) || buildDirectory.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
    throw new ArgumentException($"Invalid build path: '{buildDirectory}'", nameof(buildDirectory));
var fullPath = Path.GetFullPath(buildDirectory); // throws same way before invoking the tool

Try / catch

try { Path.GetFullPath(buildDirectory); } catch (Exception ex) { Console.Error.WriteLine($"--build-path is not a valid path: {buildDirectory}"); return 1; }

Prevention

When it happens

Trigger: Running the Stride asset build tool (PackageBuilder) with a --build-path / BuildDirectory value that Path.GetFullPath cannot resolve, such as a string containing illegal filesystem characters, or an empty/whitespace-only value that was not caught earlier.

Common situations: Shell quoting issues injecting stray characters into --build-path; environment-specific illegal characters (e.g. '<', '|', ':' on Windows); build scripts concatenating variables that produce a malformed path; forgetting to set build directory in CI configuration.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/c47188338c7d7f0f. Report an issue: GitHub.

Appendix: source

Thrown at sources/assets/Stride.AssetCompiler/PackageBuilderOptions.cs:89

        /// <summary>
        /// Ensure every parameter is correct for a master execution. Throw an OptionException if a parameter is wrong
        /// </summary>
        /// <exception cref="Mono.Options.OptionException">This tool requires one input file.;filename
        /// or
        /// The given working directory \ + workingDir + \ does not exist.;workingdir</exception>
        public void ValidateOptions()
        {
            if (string.IsNullOrWhiteSpace(BuildDirectory))
                throw new ArgumentException("This tool requires a build path.", "build-path");

            try
            {
                BuildDirectory = Path.GetFullPath(BuildDirectory);
            }
            catch (Exception)
            {
                throw new ArgumentException("The provided path is not a valid path name.", "build-path");
            }

            if (SlavePipe == null)
            {
                if (!string.IsNullOrWhiteSpace(PackageManifestFile))
                {
                    if (!File.Exists(PackageManifestFile))
                        throw new ArgumentException("Build manifest [{0}] doesn't exist".ToFormat(PackageManifestFile), "packageManifestFile");
                }
                else if (string.IsNullOrWhiteSpace(PackageFile))
                {
                    if (string.IsNullOrWhiteSpace(SolutionFile) || PackageId == Guid.Empty)
                    {
                        throw new ArgumentException("This tool requires an input file (package, project, or .sdbuild manifest), or a --solution-file and --package-id.", "inputPackageFile");
                    }
                }
                else if (!File.Exists(PackageFile))
                {

View on GitHub (pinned to 96fad776d2)