{"record":{"id":"d8cec65e9ce0bcd1","repo":"dotnet/BenchmarkDotNet","slug":"the-full-benchmark-name-filename-combined-wit","errorCode":null,"errorMessage":"The full benchmark name: \"{fileName}\" combined with artifacts path: \"{details.Config.ArtifactsPath}\" is too long. Please set the value of config.ArtifactsPath to shorter path or rename the type or method.","messagePattern":"The full benchmark name: \"(.+?)\" combined with artifacts path: \"(.+?)\" is too long\\. Please set the value of config\\.ArtifactsPath to shorter path or rename the type or method\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Helpers/ArtifactFileNameHelper.cs","lineNumber":62,"sourceCode":"\n            return GetFilePath(fileName, details, subfolder, creationTime, fileExtension);\n        }\n\n        private static string GetLimitedFilePath(DiagnoserActionParameters details, string? subfolder, DateTime? creationTime, string fileExtension, int limit)\n        {\n            string shortTypeName = FolderNameHelper.ToFolderName(details.BenchmarkCase.Descriptor.Type, includeNamespace: false);\n            string methodName = details.BenchmarkCase.Descriptor.WorkloadMethod.Name;\n            string parameters = details.BenchmarkCase.HasParameters\n                ? $\"-hash{Hashing.HashString(FullNameProvider.GetMethodName(details.BenchmarkCase))}\"\n                : string.Empty;\n\n            string fileName = $@\"{shortTypeName}.{methodName}{parameters}\";\n\n            string finalResult = GetFilePath(fileName, details, subfolder, creationTime, fileExtension);\n\n            if (finalResult.Length > limit)\n            {\n                throw new NotSupportedException($\"The full benchmark name: \\\"{fileName}\\\" combined with artifacts path: \\\"{details.Config.ArtifactsPath}\\\" is too long. \" +\n                   $\"Please set the value of {nameof(details.Config)}.{nameof(details.Config.ArtifactsPath)} to shorter path or rename the type or method.\");\n            }\n\n            return finalResult;\n        }\n\n        private static string GetFilePath(string fileName, DiagnoserActionParameters details, string? subfolder, DateTime? creationTime, string fileExtension)\n        {\n            // if we run for more than one toolchain, the output file name should contain the name too so we can differ net462 vs net8.0 etc\n            if (details.Config.GetJobs().Select(job => ToolchainExtensions.GetToolchain(job)).Distinct().Count() > 1)\n                fileName += $\"-{details.BenchmarkCase.Job.Environment.Runtime?.Name ?? details.BenchmarkCase.GetToolchain()?.Name ?? details.BenchmarkCase.Job.Id}\";\n\n            if (creationTime.HasValue)\n                fileName += $\"-{creationTime.Value.ToString(BenchmarkRunnerClean.DateTimeFormat)}\";\n\n            fileName = FolderNameHelper.ToFolderName(fileName);\n\n            if (!string.IsNullOrEmpty(fileExtension))","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Helpers/ArtifactFileNameHelper.cs#L44-L80","documentation":"ArtifactFileNameHelper throws NotSupportedException when the assembled output file path exceeds the platform length limit. The check guards Windows MAX_PATH-style constraints so diagnoser/exporter artifacts can actually be written. The message identifies the offending benchmark name and ArtifactsPath and tells you to shorten one of them.","triggerScenarios":"The final artifact path (ArtifactsPath + folder + type.method + parameter hash + toolchain suffix + extension) exceeds the configured length limit, triggering the guard before a write is attempted.","commonSituations":"Long benchmark class/method names, deeply nested namespaces, very long ArtifactsPath, many parameter combinations producing long hash suffixes, or running on Windows where path limits bite first.","solutions":["Set config.ArtifactsPath to a shorter path (e.g. a drive root like C:\\bdn or /tmp/bdn).","Shorten the benchmark type and/or method name.","Reduce the number of parameters/arguments so the generated filename is shorter.","On Windows, enable long-path support (LongPathsEnabled) as a secondary mitigation, though shortening is the robust fix."],"exampleFix":"// before\nconfig.ArtifactsPath = @\"C:\\Users\\very\\long\\deeply\\nested\\directory\\benchmarks\";\n\n// after\nconfig.ArtifactsPath = @\"C:\\bdn\";","handlingStrategy":"validation","validationCode":"// estimate the worst-case path length before running\nvar approx = Path.Combine(config.ArtifactsPath, typeName, methodName);\nif (approx.Length > 200) config.ArtifactsPath = @\"C:\\bdn\";","typeGuard":null,"tryCatchPattern":"try { runner.Run(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"too long\")) { config.ArtifactsPath = shortPath; /* retry */ }","preventionTips":["Use a short ArtifactsPath near a drive/filesystem root.","Keep benchmark type and method names concise.","On Windows, enable LongPathsEnabled as a secondary mitigation."],"tags":["file-system","path-length","config","windows"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}