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
488 stars 78 forks source link

Parse error in file C:\Users\[user-name]\.sfdx\stash.json on line 1 #421

Closed viviramji closed 2 years ago

viviramji commented 4 years ago

Summary

Greetings

I stopped working on my org via VS code a couple of weeks and when I came back to work on it I try to retrieve all on my sandbox org as usual but I got this error:

Parse error in file C:\Users\[user-name]\.sfdx\stash.json on line 1

I went to that file and I found this

NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, (repeatedly)

Steps To Reproduce:

  1. Go to package.xml
  2. Retrieve source in manifest

Expected result

Retrieve source from Org successfully Ran ended with exit code 0

Actual result

Error message Parse error in file C:\Users[user-name].sfdx\stash.json on line 1

Additional information

I don't know how the stash.json file changed its value. I work on multiple orgs and all of them gave me the same error.

HOW TO SOLVED

At first, I didn't know that I could delete the stash.js so I did some search and found that this file is generated automatically.

So I deleted and went to vs code retrieve all from my org and works!

I made this report because maybe someone is passing through this and can try this.

Thanks.

SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.60.0-e2bb2907cb win32-x64 node-v10.15.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.2.3 (core)
@oclif/plugin-help 2.2.3 (core)
@oclif/plugin-not-found 1.2.3 (core)
@oclif/plugin-plugins 1.7.9 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.7.1 (core)
generator 1.1.2 (core)
salesforcedx 48.16.2 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.5 (core)
├─ salesforcedx-templates 48.18.0 (core)
└─ salesforce-alm 48.17.0 (core)
sfdx-cli 7.60.0 (core)

OS and version: Windows 10

ghost commented 4 years ago

Thanks , it helped a lot.

Monisfdc commented 4 years ago

I was struggling to this issue, now resolved. Thanks a lot.

Pooja-sfdc commented 4 years ago

Thanks! wasted my an hour to solve the issue. Then I just read the solution here and deleted the stash file and it worked. :)

CHRISJEF94 commented 4 years ago

Thanks! I'm trying to finish my work and suddenly this issue appeared.

reda-benhemmouche commented 4 years ago

Of course if you delete or fix the stash.json file it will work. But this is a temporary solution this bug should be fixed.

We use Jenkins and we get this error many times when we have a lot of activities (deployment to sandbox or validating PR). ERROR running force:mdapi:deploy: Parse error in file /home/jenkins/.sfdx/stash.json on line I think this is related to parallel access to the file .sfdx/stash.json by multiple instances of sfdx. The sfdx code is not thread safe !

viviramji commented 4 years ago

@reda-benhemmouche, sorry, if I didn't say that this is a temporary solution you're right it is, but I haven't the pleasure to work in companies who use automated testing, Jenkins, or that stuff for knowing if my solution is completely right.

Thanks for your replay, and hope to hear about a real solution soon.

clairebianchi commented 4 years ago

@viviramji or @reda-benhemmouche do you only see this in Sandboxes? Is it something that happens after a while of not interacting with the Sandbox? In order for us to fix the bug, we need a repo where we can reproduce the issue. Would one of you be able to provide that or reproduce it with Dreamhouse?

viviramji commented 4 years ago

@viviramji or @reda-benhemmouche do you only see this in Sandboxes? Is it something that happens after a while of not interacting with the Sandbox? In order for us to fix the bug, we need a repo where we can reproduce the issue. Would one of you be able to provide that or reproduce it with Dreamhouse?

Hi @clairebianchi ! Sorry for the late response, this happens very rarely. From I posted this issue only happened one time (a week ago) and I think happened because while I was deploying some changes, my computer turned off. Thanks.

nhall97 commented 3 years ago

Issue still persists in

sfdx-cli/7.73.1

Hard to duplicate is not easy to find identify scenario that triggered it.

Summary During session (full day working okay) - I went to push the a Apex class as normal - and recieved this error:

Error: Parse error in file /export/home//.sfdx/stash.json on line 1 FILE HAS NO CONTENT

There was no difference in performing what I had been doing all day.

@oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.2.0 (core) @oclif/plugin-not-found 1.2.4 (core) @oclif/plugin-plugins 1.9.0 (core) @oclif/plugin-update 1.3.10 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.4.2 (core) alias 1.1.1 (core) analytics 1.12.1 (core) config 1.1.8 (core) generator 1.1.3 (core) salesforcedx 49.9.2 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ apex 0.0.9 (core) ├─ custom-metadata 1.0.10 (core) ├─ templates 49.4.4 (core) └─ salesforce-alm 49.10.0 (core) sfdx-cli 7.73.1 (core)

nhall97 commented 3 years ago

sfdx.log Extract:

{"name":"sfdx","hostname":"XXX","pid":20688,"log":"SfdxProjectJson","level":40,"msg":"The config file: /export/home/ZZZZ/.sfdx/sfdx-project.json is not schema valid\nDue to: Validation errors:\nshould have required property 'packageDirectories'","time":"2021-01-11T16:41:08.834Z","v":0}
{"name":"sfdx","hostname":"XXX","pid":20688,"log":"SfdxProjectJson","level":40,"msg":"The config file: /export/home/ZZZZ/.sfdx/sfdx-project.json is not schema valid\nDue to: Validation errors:\nshould have required property 'packageDirectories'","time":"2021-01-11T16:41:08.846Z","v":0}
{"name":"sfdx","hostname":"XXX","pid":20688,"log":"SourceRetrieveCommand","level":50,"msg":"[ 'ERROR running force:source:retrieve: ',\n  'Parse error in file /export/home/ZZZZ/.sfdx/stash.json on line 1\\nFILE HAS NO CONTENT\\n' ]","time":"2021-01-11T16:41:08.855Z","v":0}
{"name":"sfdx","hostname":"XXX","pid":21982,"log":"OrgOpenCommand","level":50,"msg":"[ 'ERROR running force:org:open: ',\n  'This command requires a username. Specify it with the -u parameter or with the \"sfdx config:set defaultusername=<username>\" command.' ]","time":"2021-01-11T16:53:25.192Z","v":0}
{"name":"sfdx","hostname":"XXX","pid":22059,"log":"SfdxProjectJson","level":40,"msg":"The config file: /export/home/ZZZZ/.sfdx/sfdx-project.json is not schema valid\nDue to: Validation errors:\nshould have required property 'packageDirectories'","time":"2021-01-11T16:54:00.963Z","v":0}
{"name":"sfdx","hostname":"XXX","pid":22059,"log":"SfdxProjectJson","level":40,"msg":"The config file: /export/home/ZZZZ/.sfdx/sfdx-project.json is not schema valid\nDue to: Validation errors:\nshould have required property 'packageDirectories'","time":"2021-01-11T16:54:00.974Z","v":0}
{"name":"sfdx","hostname":"XXX","pid":22059,"log":"SourceRetrieveCommand","level":50,"msg":"[ 'ERROR running force:source:retrieve: ',\n  'Parse error in file /export/home/ZZZZ/.sfdx/stash.json on line 1\\nFILE HAS NO CONTENT\\n' ]","time":"2021-01-11T16:54:00.986Z","v":0}
mshanemc commented 2 years ago

this was fixed in the new plugin-source version of source:deploy/retrieve.