OctoPack error: Could not find a part of the path

If you’re managing numerous Octopus projects across an enterprise, you’re bound to run into an error you’ve never seen before. Most frequently for us, that comes with the build process. Users often confuse (by no fault of their own) the source of the error being the OctoPack but in my experience, the OctoPack in and of itself has very few if any errors. When teams compile applications whether on TFS, TeamCity, etc. errors typically happen during or after the build process. A colleague (@tptechgeek) of mine from Avanade on a separate project reached out to me yesterday with an error that I haven’t seen before:

MSBUILD : OctoPack error OCTONUGET: Could not find a part…

Minor detour ahead
While channel surfing this weekend, I found a classic Bill Murray movie playing called Quick Change. There’s a scene in which Bill and two accomplices are trying to get to the airport but get lost. In asking for directions from some construction workers, I saw a parallel example between Bill’s experience in getting guidance and hunting down errors in NuGet. There’s a line that I love from this scene:

You know, I want to thank you guys, you could’ve given us help, but you’ve given us so much more.

The OctoPack’s error message leave a lot to be desired, but it’s hard to blame it when you read further of what the issue is being reported by NuGet.

MSBUILD : OctoPack error OCTONUGET: Could not find a part…MSBUILD : OctoPack error OCTONUGET: Could not find a part of the path ‘C:\Some\Cool\App’. [C:\Some\Cool\App\Src\AwesomeApp\SomeProject\SomeProject.csproj]
MSBUILD : OctoPack error OCT-1676060969: There was an error calling NuGet. Please see the output above for more details. Command line: ‘C:\Some\Cool\App\Src\AwesomeApp\packages\OctoPack.3.0.31\
tools\NuGet.exe’ pack “C:\Some\Cool\App\Src\AwesomeApp\SomeProject\obj\octopacking\SomeProject.nuspec” -NoPackageAnalysis -BasePath “C:\Some\Cool\App\Src\AwesomeApp\SomeProject” -Ou
tputDirectory “C:\Some\Cool\App\Src\AwesomeApp\SomeProject\obj\octopacked” -Version [C:\Some\Cool\App\Src\AwesomeApp\SomeProject\SomeProject.csproj]
MSBUILD : OctoPack error OCT-1676060969: System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: ‘C:\Some\Cool\App\Src\AwesomeApp\package
s\OctoPack.3.0.31\tools\NuGet.exe’ pack “C:\Some\Cool\App\Src\AwesomeApp\SomeProject\obj\octopacking\SomeProject.nuspec” -NoPackageAnalysis -BasePath “C:\Some\Cool\App\Src\AwesomeApp\
Visualization” -OutputDirectory “C:\Some\Cool\App\Src\AwesomeApp\SomeProject\obj\octopacked” -Version\r [C:\Some\Cool\App\Src\AwesomeApp\SomeProject\SomeProject.csproj]
MSBUILD : OctoPack error OCT-1676060969: at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\46cfb6001
f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 520\r [C:\Some\Cool\App\Src\AwesomeApp\SomeProject\SomeProject.csproj]
MSBUILD : OctoPack error OCT-1676060969: at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 181 [C:\Projects\AwesomeApp\

There’s a fine line between cryptic and useless and I think NuGet has struck a pretty good balance between the two. I’ve learned to ignore most of error messages within the logs and just figure out the core message, which is apparently too difficult for NuGet to convey. Here the key repeated message is “could not find a part of the path”. Path to what? Beats me. Ok, so let’s start from the beginning.

  1. Is a NuGet package being created? No.
  2. Are we sure the OctoPack is installed? Yes.
  3. Are the build template parameters correct for the OctoPack? Yes. (my colleague was using TeamCity, but the point remains on passing correct parameters to the OctoPack)
  4. Is the nuspec file in place? Yes.
  5. Are there specific <files> tags in the nuspec? Yes.
  6. Are we certain the paths being targeted in the nuspec work? No.

This was how we (eventually) arrived to the solution of our problem: the NuSpec file paths within the <files> tag were not valid. Even though he was using an older version of the OctoPack (2.x) which worked correctly, after he upgraded to 3.0.31 the same NuSpec file didn’t work as before. After changing all the paths within the file tags, the OctoPack and by extension, NuGet, worked just fine. Is this solution the root cause of all “Could not find a part of the path” NuGet error messages? Probably not. But it’s one possible source of error messages like this in your OctoPack error message debugging adventures.



3 Responses

  1. Thankyou! In my case – one of my project file names had slightly different casing. Fixed that and it resolved the issue. Nice one.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment