forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

sfdx push -> An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Index file is empty #2194

Closed Arkin69 closed 1 year ago

Arkin69 commented 1 year ago

image

Error (1): An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Index file is empty (.git/index)

git version : 2.41.0.windows.1 sfdx version : sfdx-cli/7.205.6 (same issue with the previous version after a rollback)

I tried to clone again my repository to regenerate my index file but the same error appears.

Same behaviour with powershell 7 or 5.

github-actions[bot] commented 1 year ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

petter-eikeland commented 1 year ago

We have also noticed this. We had to delete the scratch org and create a new for the error to disappear.

MicrosoftTeams-image

Might be worth to add this occurred after undeleting a file locally (CMD+z in IDE) and then trying to push afterwards

aldensc commented 1 year ago

Same issue occurred to me twice in the last 2 days. Had to kill the push, which appeared to be hung after many minutes. I have killed these in the past and never run into this issue.

sfdx force:source:push -f Warning: We plan to deprecate this command in the future. Try using the "project deploy start" command instead. Error (1): An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Index file is empty (.git/index)

Tried sf project deploy start, which gives this error... Error (1): An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Invalid checksum in GitIndex buffer: expected but saw da39a3ee5e6b4b0d3255bfef95601890afd80709

Is there a way to fix this without rebuilding another scratch org?

tehnrd commented 1 year ago

Some more context here that might be helpful for investigating/reproducing. I am working on a plugin that will do multiple sf project retrieve start in parallel to pull down metadata quickly, and I think this might be messing up the local source tracking.

If I can reproduce it, I will add more detail, but I wanted to leave this note.

I've tried both sf project reset tracking and sf project delete tracking but they both throw the Invalid checksum error.

domrycz commented 1 year ago

Hey guys, do you have any workaround for this issue? I started getting this error on Friday and after creating new scratch org it didn't disappear. I'm using force:source:push command.

petter-eikeland commented 1 year ago

@domrycz Have you tried deleting the old scratch org and then pushing to a new? I assume you need to delete the source tracking for the faulty scratch org

mshanemc commented 1 year ago

isogit had an issue, so we've changed the CLI to use the previous version that worked fine. This'll be fixed in the next CLI release

git2gus[bot] commented 1 year ago

This issue has been linked to a new work item: W-13629507

gonzalezjesus commented 1 year ago

Could you please let us know a stable version we can move to? I have just run sfdx update -v 7.202.7" but I still get the same problem: An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Invalid checksum in GitIndex buffer: expected but saw da39a3ee5e6b4b0d3255bfef95601890afd80709

Does the existing scratch org connection get corrupted once I get the error? Or is this supposed to get back to work if I install the previous version of the CLI? Thanks in advance.

nwenslaff commented 1 year ago

@gonzalezjesus I don't know when this error was first introduced, but I was able to revert back to 7.200.5 as a workaround.

tkauffman1 commented 1 year ago

Same issue.

sss-sf-dev commented 1 year ago

I was able to get my project back to life by going into the .sf/orgs/[my scratch org id] folder and just removing everything. After that I could do a source push -f, which did the push and then updated all the tracking information and now I can work again.

Best of luck to you all.

tkauffman1 commented 1 year ago

@sss-sf-dev - I've been trying to work all day, even a small 1 file change doesn't deploy, cli freezes, What version CLI are you using?

sss-sf-dev commented 1 year ago

@sss-sf-dev - I've been trying to work all day, even a small 1 file change doesn't deploy, cli freezes, What version CLI are you using?

At first (I was working my way down through this thread) I rolled back, so now I'm on: sfdx-cli/7.200.5 darwin-x64 node-v18.16.0

After I rolled back I still had the same errors so I opened up a terminal and - as per the instructions above - just manually deleted all the tracking info for my scratch.

The incident that got me into trouble was what @aldensc reported - I got sick of waiting for a push and killed it which seemingly caused the corruption of my local tracking info.

ETA: 200 is much faster than 205 and 206 were to deploy, so I'm leaving it here for now as I'm less likely to kill a push out of frustration.

tkauffman1 commented 1 year ago

Wow - Went through the same exact thing today. I noticed source pushes taking forever , sf project deploy, sfdx force source push , sfdx force:source:push ... didn't matter took 10+ minutes to push even one file change.

I reverted back to 7.179 and it's working so much better..

cristiand391 commented 1 year ago

Hey all 👋🏼 As Shane mentioned, this seems to be caused by a dependency of the source tracking lib (isomorphic-git). We just noticed the change to downgrade isomorphic-git in the CLI wasn't released, working on it now and will let you all know when it's available in the nightly channel for testing.

Sorry for all the trouble.

jcubic commented 1 year ago

@cristiand391 which version of isomorphic-git you're using? We can fix this on our part if we will know what is the problem. From my perspective, you do something funky with the index since we didn't do anything that may corrupt the file. And there are not much difference between working and not working versions.

We keep getting a lot of bug reports because the error says to report an issue to our library, so we also want this fixed.

jcubic commented 1 year ago

We also get a contribution recently that broke the statusMatrix function that was reverted so it's worth also checking with the latest version if it works.

dead-end commented 1 year ago

The index file .git/index in the isomorphic-git error message is the default index file and may not be the one that causes the trouble. Is it possible that you have an other index file here:

.sfdx/orgs/[orgId]/localSourceTracking/index

which is empty?

cristiand391 commented 1 year ago

@jcubic yes, I think it was the issue with the statusMatrix function. We downgraded to v1.23.0 here: https://github.com/forcedotcom/source-tracking/pull/417/files

that was just released so most users reporting the issue are using isomorphic-git v1.24.0. Does 1.24.2 contains the fix for the statusMatrix regression?

sfdx-cli v7.208.7 was published to the nightly channel a few minutes ago, it contains isomorphic-git v 1.23.0 which seems to be safe. See instructions aobut how to test nightlies https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli_rc.htm

jcubic commented 1 year ago

@cristiand391 yes the 1.24.2 should have that code reverted.

thoriyas commented 1 year ago

I just ran into this issue. It was working all day and suddenly this issue started.

ts@Sagars-MacBook-Pro CRM 2GP % sfdx force source push Warning: We plan to deprecate this command in the future. Try using the "project deploy start" command instead. Error (1): An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Index file is empty (.git/index)

mpeddycord commented 1 year ago

started receiving this error this morning. even updated to nightly build version 7.208.9 and this is still an issue when trying to run sf project retrieve start on a sandbox. This has 1.24.2 version of isomorphic-git installed but is still an issue.

mpeddycord commented 1 year ago

was able to figure out the issue (at least to get back working). My index file somehow got emptied at .sf/orgs/[orgId]/localSourceTracking/index for that sandbox. I deleted this index file and was able to run "sf project retrieve start" without issue.

cristiand391 commented 1 year ago

We patched CLIs in the latest/stable channel to use isomorphic-git v1.23.0 and will be testing. v1.24.2 in the RC channel.

latest sfdx: 7.206.6 latest sf: 1.84.8

FeiyangGao commented 1 year ago

I create new project, and test the cli, it works well. Then, I empty .sf and .sfdx folder. All is OK

leonvet commented 1 year ago

Upgraded from 7.197 to 7.206.6 and also ran into the empty index file error. Removing the .sf/orgs/orgid folder and a subsequent sfdx project deploy start didn't resolve anything.

Tried a sfdx project tracking reset but cancelled it after it ran 4 hours straight with the node process at 150-200% cpu usage. Switched to a brand new scratch org and again huge cpu usage during 'sfdx project deploy start'.

Should i downgrade to 7.197 ?

npm 9.02 node 18.12.1 sfdx 7.206.6 macos ventura 13.4.1 (M1 14" model)

shetzel commented 1 year ago

@leonvet - looks like sfdx CLI v7.206.6 still had a bad version of isomorphic-git (1.24.0). sfdx v7.207.5 is latest now and it has a good version of isomorphic-git so please use that version of the CLI. I checked sf Cli v1.84.9, which is latest, and it also has a good version of that lib. Closing this issue since it's fixed in both latest CLI versions.

leonvet commented 1 year ago

Thanks Steve for looking into this

Op 5 jul. 2023 om 18:49 heeft Steve Hetzel @.***> het volgende geschreven:



@leonvet https://github.com/leonvet - looks like sfdx CLI v7.206.6 still had a bad version of isomorphic-git (1.24.0). sfdx v7.207.5 is latest now and it has a good version of isomorphic-git so please use that version of the CLI. I checked sf Cli v1.84.9, which is latest, and it also has a good version of that lib. Closing this issue since it's fixed in both latest CLI versions.

— Reply to this email directly, view it on GitHub https://github.com/forcedotcom/cli/issues/2194#issuecomment-1622129178, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHKKEWH6ZPJRKRN6Q67WWTXOWLIVANCNFSM6AAAAAAZEOGZOA . You are receiving this because you were mentioned.Message ID: @.***>

PreziosiRaffaele commented 1 year ago

Hi, I'm still facing the error mentioned above when attempting to retrieve and deploy from my scratch org using Visual Studio Code or Salesforce CLI.

Steps To Reproduce

run sf project deploy start -m LightningComponentBundle: myLWC

Expected result

myLwc component is successfully deployed

Actual result

Metadata API request failed: An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Invalid checksum in GitIndex buffer: expected cdfb50a023b8f5c4d97356a30033666f7263652d but saw 0f99d2730dc26ab30aa6dadbbf93fea1ef5f3480

System Information

 {
  "cliVersion": "@salesforce/cli/2.4.10",
  "architecture": "win32-x64",
  "nodeVersion": "node-v19.8.1",
  "osVersion": "Windows_NT 10.0.22621",
  "shell": "cmd.exe",
  "rootPath": "C:\\Users\\raffaele.preziosi\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.6 (core)",
    "@oclif/plugin-commands 2.2.21 (core)",
    "@oclif/plugin-help 5.2.16 (core)",
    "@oclif/plugin-not-found 2.3.36 (core)",
    "@oclif/plugin-plugins 3.2.0 (core)",
    "@oclif/plugin-search 0.0.22 (core)",
    "@oclif/plugin-update 3.1.30 (core)",
    "@oclif/plugin-version 1.3.8 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.46 (core)",
    "@oclif/plugin-which 2.2.29 (core)",
    "@salesforce/cli 2.4.10 (core)",
    "apex 2.3.10 (core)",
    "auth 2.8.12 (core)",
    "data 2.5.5 (core)",
    "deploy-retrieve 1.17.2 (core)",
    "dev 1.1.8 (user)",
    "info 2.6.38 (core)",
    "limits 2.3.29 (core)",
    "login 1.2.25 (core)",
    "org 2.9.30 (core)",
    "packaging 1.22.0 (user)",
    "schema 2.3.22 (core)",
    "settings 1.4.24 (core)",A
    "sobject 0.2.2 (core)",
    "source 2.10.30 (core)",
    "telemetry 2.2.5 (core)",
    "templates 55.5.9 (core)",
    "trust 2.5.4 (core)",
    "user 2.3.28 (core)",
    "@salesforce/sfdx-scanner 3.15.0 (user)",
    "move-qcp 1.2.2 (user)",
    "sfdx-git-delta 5.24.2 (user)"
  ]
}

Additional information

image

tkauffman1 commented 1 year ago

Popping up again for me today, randomly.

An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Invalid checksum in GitIndex buffer: expected 2be61f64164140a4c55ffac94c8244081f3cb6d9 but saw cb0e842c3d39f2eea6f2682c053121138dd89df2

cristiand391 commented 1 year ago

if you see this bug it could be related to your project, please file a new issue and follow the template: https://github.com/forcedotcom/cli/issues/new/choose

tgraham412 commented 1 year ago

@mpeddycord where did you access the index file that you mentioned in your response "My index file somehow got emptied at .sf/orgs/[orgId]/localSourceTracking/index for that sandbox. "? Was this in the salesforce org or in VSCode?

mpeddycord commented 1 year ago

@tgraham412 in VSCode

fmannreply commented 1 year ago

The issue now also effects me when running sf project deploy start as well as when trying to deploy via Addon (right click "Deploy this source to org").

An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Invalid checksum in GitIndex buffer: expected but saw da39a3ee5e6b4b0d3255bfef95601890afd80709

The mentioned workaround (deleting sf/sfdx folder, and reseting tracking) did not work for me persistently. I will just fallback to sf force source deploy.

@salesforce/cli/2.4.10 linux-x64 node-v18.17.0

My vs code Salesforce addon package is up to date (not sure where I can find the version).

mandyrawat commented 1 year ago

In Visual Studio Code I am not able to deploy source to org. Keep on getting this error. An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: Index file is empty (.git/index)

daniil-rozin-itechart commented 1 year ago

I am facing the same issue in version sfdx-cli/7.209.6

lucabezerra commented 1 year ago

For those still getting it today, even with the latest version of sfdx, if you're using the VSCode "Salesforce CLI Integration" extension, that might be the issue. I was using v58.14.2 (latest at the time of this writing) and had the issue. Someone suggested v57.10.2 and it worked!

Maybe the one immediately before the latest would've worked, but I'll stick to this one for as long as I can.

jsullivanlive commented 10 months ago

For anyone else reaching this thread from google (like I did), and you're intermittently having issues saving files to your scratch org, add --json --verbose to the command so you can see the full command issues.

Corrupted local tracking data can be resolved by deleting the .sf/ folder inside the project root. If you delete the .sf/ folder then next pull run will sync down a state of your scratch org and you can start saving files again.

cristiand391 commented 10 months ago

As long as you are on latest CLI and vscode extensions you shouldn't get this error, this was fixed in sf 2.12.9: https://github.com/forcedotcom/cli/tree/main/releasenotes/#2129-oct-11-2023