Long File Paths and SitecoreAI Deployments

It's 2026 and we're still dealing with long files paths in Windows based file systems!
The Scenario
I was migrating a number of WordPress posts to Sitecore. WordPress is much less strict about string length limits, so page slugs can get very long. As a first step in the migration process, I wanted to do as straightforward a migration as possible, meaning that I wanted to preserve all the original page URLs. Therefore, I needed to ensure that the item names in Sitecore matched the original page URLs. Not only that, but new datasource items needed to be created in the data folder of those new items, causing the file paths to balloon. As usual, I did the migration on my local machine and all seemed fine, until I started pushing the code upstream.
The Errors
At first it started with my GitHub Action for building started failing because of long file paths. As a first step, I just enabled long paths in git. This worked, but later when I tried deploying the artifacts to SitecoreAI, I got the following error:
Unexpected error
I had to go deeper.
I turned on verbose logging when deploying to SitecoreAI via this command:
dotnet sitecore cloud deployment create --environment-id $sitecoreCloudEnvironmentId --upload --verbose
And the error was:
Creating deployment...Create deploymentEnvironment Id: 'xxxxxxxxxxxxxxxxx'Executing POST request '/api/environments/v2/xxxxxxxxxxxxxxxxx/deployments'POST data '{"environmentId":"xxxxxxxxxxxxxxxxx"}'Finished POST request'https://xmclouddeploy-api.sitecorecloud.io/api/environments/v2/xxxxxxxxxxxxxxxxx/deployments' with status AcceptedPrepare artifacts and zip themUnhandled exception: System.Exception: Unhandled exception---> System.Exception: Unhandled exception---> LibGit2Sharp.LibGit2SharpException: path too long: 'F:/Octopus/Work/xxxxxxxxxxxxxxxxx/Work/authoring/items/sites.migration/sites.migration.home/F96B90C49A1BFCE4/driving-innovation-with-artificial-intelligence-the-advantages-and-pitfalls-of-utilizing-ai-as-a-business-transformation-tool/Data/CallToActionLink 001.yml'at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 172at LibGit2Sharp.Core.Proxy.git_status_list_new(RepositoryHandle repo, GitStatusOptions options) in /_/LibGit2Sharp/Core/Proxy.cs:line 2946at LibGit2Sharp.RepositoryStatus..ctor(Repository repo, StatusOptions options) in /_/LibGit2Sharp/RepositoryStatus.cs:line 61at LibGit2Sharp.Repository.RetrieveStatus(StatusOptions options) in /_/LibGit2Sharp/Repository.cs:line 1686at Sitecore.DevEx.Extensibility.XMCloud.Services.GitIgnoreService.GetFiles(String workingDir, Boolean traceLogging)+MoveNext()at Sitecore.DevEx.Extensibility.XMCloud.Services.CustomImageBuild.ZipService.Zip(String workingDirPath, Boolean traceLogging)at Sitecore.DevEx.Extensibility.XMCloud.Tasks.Deploy.BaseDeploymentCreateTask.UploadSourceCode(DeploymentCreateArgs args, String deploymentId)at Sitecore.DevEx.Extensibility.XMCloud.Tasks.Deploy.BaseDeploymentCreateTask.HandleInternal(DeploymentCreateArgs args)at Sitecore.DevEx.Extensibility.XMCloud.Tasks.Deploy.DeploymentCreateTask.HandleInternal(DeploymentCreateArgs args)at Sitecore.DevEx.Extensibility.XMCloud.Tasks.BaseTask`2.Handle(TArgs args)at Sitecore.DevEx.Extensibility.XMCloud.Commands.BaseCommand`2.Handle(TTask task, TArgs args)--- End of inner exception stack trace ---at Sitecore.DevEx.Extensibility.XMCloud.Commands.BaseCommand`2.Handle(TTask task, TArgs args)at Sitecore.DevEx.Extensibility.XMCloud.Commands.BaseCommand`3.Handle(TTask task, TArgs args)at Sitecore.DevEx.Client.Cli.Extensibility.Subcommands.SubcommandBase`2.HandleInternal(TArgs args) in C:\BA\ca7111d945a16af4\src\Sitecore.Devex.Client.Cli.Extensibility\Subcommands\SubcommandBase.cs:line 95--- End of inner exception stack trace ---at Sitecore.DevEx.Client.Cli.Extensibility.Subcommands.SubcommandBase`2.HandleExceptionMessageConsoleLogging(Exception exception, ILogger logger) in C:\BA\ca7111d945a16af4\src\Sitecore.Devex.Client.Cli.Extensibility\Subcommands\SubcommandBase.cs:line 143at Sitecore.DevEx.Client.Cli.Extensibility.Subcommands.SubcommandBase`2.HandleInternal(TArgs args) in C:\BA\ca7111d945a16af4\src\Sitecore.Devex.Client.Cli.Extensibility\Subcommands\SubcommandBase.cs:line 0at System.CommandLine.Invocation.CommandHandler.GetExitCodeAsync(Object value, InvocationContext context)at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()--- End of stack trace from previous location ---at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()Done.The remote script failed with exit code 1The action Deploy SitecoreAI on a Worker failedTherefore, the ultimate bottleneck is SitecoreAI.
How to Fix it
Ask AI for suggestions. There are a handful of good options that will help in most cases. The trickiest case to solve for is deeply nested page paths with long item names. Those cases will require special handling, however, this case came about while doing initial content migrations. Normally content items would not be stored in the file system/source control; they would be stored in the database, where file paths are typically not an issue.
Learnings
- Identify potential areas of long paths early in the project.
- Ensure migration scripts account for path length limitations.
- Don't just enable long paths in git. Address long file paths at the source.
Feature Requested
I did ask Sitecore Support if they are considering adding support for long file paths. They provided me the public reference number XS-12033.
Why the long face?
-MG





