Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI to fix invalid .ipfs or .ipfs/config #2050

Closed
DJTHIEVES opened this issue Mar 19, 2022 · 1 comment · Fixed by #2067
Closed

Add UI to fix invalid .ipfs or .ipfs/config #2050

DJTHIEVES opened this issue Mar 19, 2022 · 1 comment · Fixed by #2067
Assignees
Labels
effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up

Comments

@DJTHIEVES
Copy link

👉️ Please describe what you were doing when this error happened.

Specifications

  • OS: win32
  • IPFS Desktop Version: 0.20.2
  • Electron Version: 17.1.0
  • Chrome Version: 98.0.4758.102

Error

SyntaxError: C:\Users\james whirl\.ipfs\config: Unexpected token � in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.readFileSync (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\node_modules\jsonfile\index.js:52:17)
    at readConfigFile (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\src\daemon\config.js:29:13)
    at checkPorts (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\src\daemon\config.js:214:18)
    at module.exports (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\src\daemon\daemon.js:171:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async startIpfs (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\src\daemon\index.js:46:17)
    at async module.exports (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\src\daemon\index.js:114:3)
    at async run (C:\Users\james whirl\AppData\Local\Programs\IPFS Desktop\resources\app.asar\src\index.js:83:5)%
@DJTHIEVES DJTHIEVES added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Mar 19, 2022
@ipfs ipfs deleted a comment from welcome bot Mar 21, 2022
@lidel
Copy link
Member

lidel commented Mar 21, 2022

This seems to be a problem where JSON .ipfs/config file or .ipfs directory itself are corrupted.

Desktop should detect this easily before its attempt to start the daemon.

  1. try block: read ${ipfsConfig.path}/config and then JSON.parse it to confirm JSON is valid
  2. if any error show dialog to user and inform them that the .ipfs or config file is corrupted
  • The dialog should inform the user about the location of .ipfs, and that .ipfs/config has to be a valid JSON.
  • It should ask user to fix the config or rename old repo to .ipfs.backup before trying to start IPFS Desktop again.
  • There should be only one button: "Quit"

We should not try to be too smart about this – there are too many things that could be broken in .ipfs, config being invalid JSON could be a symptom of bigger disk corruption caused by failing disk drive, user doing YOLO edits of config by hand etc.

By doing as little as possible, this will also work for cases like #2026 where .ipfs itself is not a directory, but a file.

@lidel lidel added exp/intermediate Prior experience is likely helpful P1 High: Likely tackled by core team if no one steps up effort/hours Estimated to take one or several hours and removed need/triage Needs initial labeling and prioritization labels Mar 21, 2022
@lidel lidel changed the title [gui error report] SyntaxError: C:\Users\james whirl\.ipfs\config: Unexpected token � in JS Add UI to fix invalid .ipfs/config Mar 21, 2022
@lidel lidel changed the title Add UI to fix invalid .ipfs/config Add UI to fix invalid .ipfs or .ipfs/config Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants