isomorphic-git: Unable to push: Expected "Two strings separated by '\x00'" but received ...

Hi!

I’m using Backstage that is backed by the isomorphic-git project in their scaffolder among other places. Today i (and many with me) started getting this error when we push scaffolded projects to GitHub using isomorphic.

I haven’t dug any deeper in the actual code what it does, but i’m fairly sure this affects many isomorphic-git versions, and this started happening without a new deployment or upgrade but in several running systems. Personally i’m running 1.23.0 and i’m running it in NodeJS as an environment.

The error

2025-05-27T11:39:15.202Z error: Failed to push to repo {dir=/tmp/516c73a5-d09b-4c35-8ed9-89aee4d07a16/ephemeral-argocd, remote=origin}
2025-05-27T11:39:15.203Z Error: Expected "Two strings separated by '\x00'" but received "9a29347f4c4c7934022600aef1c1c6d0d2eb61da refs/heads/livereport-status report-status-v2 delete-refs side-band-64k ofs-delta atomic object-format=sha1 quiet agent=github/spokes-receive-pack-acac8763c60f636c44baaf5c3887895cf5f55c30 session-id=9478:2F056A:88C0F4:C3A7F1:6835A462 push-optio
". {data={"expected":"Two strings separated by '\\x00'","actual":"9a29347f4c4c7934022600aef1c1c6d0d2eb61da refs/heads/live\u0000report-status report-status-v2 delete-refs side-band-64k ofs-delta atomic object-format=sha1 quiet agent=github/spokes-receive-pack-acac8763c60f636c44baaf5c3887895cf5f55c30 session-id=9478:2F056A:88C0F4:C3A7F1:6835A462 push-optio\u0000\n"}}
    at Git.push (/app/node_modules/@backstage/backend-common/dist/index.cjs.js:1908:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (/app/plugins/scaffolder-backend-module-scaffolder-internal-actions/dist/actions/actions.cjs.js:109:7)
    at async NunjucksWorkflowRunner.executeStep (/app/node_modules/@backstage/plugin-scaffolder-backend/dist/scaffolder/tasks/NunjucksWorkflowRunner.cjs.js:243:9)

Here is a backlink to the Backstage discord where this issue is discussed at the moment.

We seem to all agree there that either GitHub changed or broken something. I’m not sure if it is on the isomorphic-git project or github to fix. I’ll leave that to you to decide.

And here’s a gist of the code where i’m doing the push. https://gist.github.com/O5ten/5034f3a6d7e3231add9eb7defc4f4c8b

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 55
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Someone in the backstage-discord had also been in contact with GitHub support, they suggested to them to use simple-git. 😆

It seems to work now again. A rollback was made. 🙃

Image

Edit: GitHub has released a statement

We’re seeing this issue in our usage of isomorphic-git as well. We’ve identified that there is an additional null char in the response from github which isn’t there with the same query on a bitbucket repo. We’ve forked isomorphic-git and updated this line to if (split.length < 2) { which temporarily patches the issue for us. We’ve raised an issue with Github to fix the underlying cause.

I’ve asked a question on GitHub discussions:

I hope someone from GitHub stuff will confirm that something changed.

Someone in the backstage-discord had also been in contact with GitHub support, they suggested to use simple-git. 😆

It’s even worse than saying "Just use the native git binary”

We’ve forked isomorphic-git and updated this line to if (split.length < 2) { which temporarily patches the issue for us

We with similar solution but using https://yarnpkg.com/cli/patch instead to add changes into isomorphic-git package

Did you report this to Backstage?

\x00 is exactly the same character as \u0000

$ node
Welcome to Node.js v20.6.1.
Type ".help" for more information.
> '\u0000'
'\x00'

I’ve been looking for an answer for this for a couple hours as well. We’re using the latest isomorphic-git version in our backstage deployment. We haven’t updated or changed anything, so we believe github broke the /info/refs?service=git-receive-pack endpoint, by responding with \u0000 instead of \x00