question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Invalid tree info" - Fileless directories

See original GitHub issue

Following along with sbt-microsite: Publish using GitHub4s, I’ve created a token with the repo scope, and have Enable SSO’d (which is required by my environment).

I was then able to use the Github API to perform some simple tests:

  • List commits for my repo
  • List entries for a given tree

Despite this, when attempting to use publishMicrosite, I get:

[error] Error committing filesGitHub returned an error: Failed invoking with status : 422 body :
 {"message":"Invalid tree info","documentation_url":"https://developer.github.com/v3/git/trees/#create-a-tree"}

        at sbtorgpolicies.github.syntax$GHResponseOps.execE(syntax.scala:53)
        at sbtorgpolicies.github.syntax$EitherTOps.execE(syntax.scala:43)
        at sbtorgpolicies.github.GitHubOps.commitDir(GitHubOps.scala:172)
        at sbtorgpolicies.github.GitHubOps.commitDir(GitHubOps.scala:148)
        at microsites.MicrositeAutoImportSettings.$anonfun$micrositeTasksSettings$13(MicrositeKeys.scala:305)
        at scala.Function1.$anonfun$compose$1(Function1.scala:44)
        at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:67)
        at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
        at sbt.Execute.work(Execute.scala:278)
        at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
        at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: github4s.GithubResponses$UnsuccessfulHttpRequest: Failed invoking with status : 422 body :
 {"message":"Invalid tree info","documentation_url":"https://developer.github.com/v3/git/trees/#create-a-tree"}
        at github4s.HttpRequestBuilderExtensionJVM.toEntity(HttpRequestBuilderExtensionJVM.scala:84)
        at github4s.HttpRequestBuilderExtensionJVM.toEntity$(HttpRequestBuilderExtensionJVM.scala:74)
        at github4s.jvm.Implicits$.toEntity(Implicits.scala:21)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.$anonfun$runMap$3(HttpRequestBuilderExtensionJVM.scala:67)
        at scala.util.Try$.apply(Try.scala:209)
        at sbtorgpolicies.github.instances$$anon$2.capture(instances.scala:57)
        at sbtorgpolicies.github.instances$$anon$2.capture(instances.scala:56)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.runMap(HttpRequestBuilderExtensionJVM.scala:61)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.run(HttpRequestBuilderExtensionJVM.scala:34)
        at github4s.HttpClient.post(HttpClient.scala:159)
        at github4s.api.GitData.createTree(GitData.scala:251)
        at github4s.free.interpreters.Interpreters$$anon$9.$anonfun$apply$7(Interpreters.scala:295)
        at cats.data.Kleisli.$anonfun$map$1(Kleisli.scala:19)
        at cats.data.KleisliFlatMap.$anonfun$tailRecM$2(Kleisli.scala:534)
        at cats.instances.TryInstances$$anon$1.tailRecM(try.scala:57)
        at cats.instances.TryInstances$$anon$1.tailRecM(try.scala:15)
        at cats.data.KleisliFlatMap.$anonfun$tailRecM$1(Kleisli.scala:534)
        at cats.data.Kleisli.$anonfun$map$1(Kleisli.scala:19)
        at cats.data.KleisliFlatMap.$anonfun$tailRecM$2(Kleisli.scala:534)
        at cats.instances.TryInstances$$anon$1.tailRecM(try.scala:57)
        at cats.instances.TryInstances$$anon$1.tailRecM(try.scala:15)
        at cats.data.KleisliFlatMap.$anonfun$tailRecM$1(Kleisli.scala:534)
        at github4s.Github$GithubIOSyntaxEither.exec(Github.scala:62)
        at sbtorgpolicies.github.syntax$GHResponseOps.execE(syntax.scala:51)
        ... 19 more

I found https://github.com/47deg/sbt-org-policies/issues/388#issuecomment-437045396, which was largely unhelpful other than to suggest that perhaps despite supplying the token, it doesn’t work as advertised (possibly in my SSO environment).

Any assistance would be appreciated!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
stanleydunnecommented, Jul 26, 2019

I am seeing the same error “Invalid tree info” when trying to use the API to add individual files to my repo. I don’t have empty folders. Has a solution been found? Edit : I found other issue in my own code that was corrupting the data I was passing in. Ignore my question.

0reactions
artemkorsakovcommented, Sep 17, 2020

I have the same problem. While I had such a structure the publication was successful:

  • dir1
    • dir2
      • index.md
      • file1.md
      • file2.md
    • index.md
    • file1.md
    • file2.md
  • index.md
  • file1.md
  • file2.md

When I got such a structure that the publication began to fail with an error “Invalid tree info”:

  • dir1
    • dir2
      • index.md
      • file1.md
      • file2.md
    • dir3
      • dir4
        • index.md
        • file1.md
        • file2.md
    • index.md
    • file1.md
    • file2.md
  • index.md
  • file1.md
  • file2.md

I got directory dir3 with no files in it - just another directory (dir4) The error “Invalid tree info” went away only after I added the file to the directory dir3:

  • dir1
    • dir2
      • index.md
      • file1.md
      • file2.md
    • dir3
      • dir4
        • index.md
        • file1.md
        • file2.md
      • index.md
    • index.md
    • file1.md
    • file2.md
  • index.md
  • file1.md
  • file2.md
Read more comments on GitHub >

github_iconTop Results From Across the Web

"Invalid tree info" - Fileless directories · Issue #259 - GitHub
I found that github4s will struggle to commit this structure (422), with the culprit being the fileless microsite directory. As a workaround I ......
Read more >
File and Directory Discovery, Technique T1083 - Enterprise
ID Name Description S0045 ADVSTORESHELL ADVSTORESHELL can list files and directories. S0031 BACKSPACE BACKSPACE allows adversaries to search for files. S0234 Bandook Bandook has a command...
Read more >
Malware Analysis: Memory Forensics with Volatility 3
In this post, we're going to take a look a Volatility 3, the newest version of the industries most popular memory forensics tool....
Read more >
I cannot add the parent directory to *safe.directory* in Git
git folder (the git repository) is the issue. Cloning the project anew is a platform independent way to make sure you are the...
Read more >
TXOne StellarOne for StellarEnforce - Trend Micro
An “exported endpoint info.csv” file will be downloaded to the folder which your browser specifies. It includes all agent information. Page ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found