code-server: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'

  • code-server version: v1.31.1-100
  • OS Version: Ubuntu 18.10

Steps to Reproduce

  1. use docker to start code-server, wait a while
  2. and you will see this error:
ERROR SHARED stderr {"data":"Uncaught Exception:  Error: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'\n    at Timeout.eval [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27336), <anonymous
>:76664:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:
290:5)\n"}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 131
  • Comments: 71 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Please avoid me too comments in favour of using GitHub reactions.

@mdp that’s an issue with opening an invalid folder. We’ve fixed that on master. Will come in a release later today.

Was it released?

Thanks

me too

@mdp that’s an issue with opening an invalid folder. We’ve fixed that on master. Will come in a release later today.

After creating a workspaces.json in the desired directory and filling it with the content

{
        "folders": [
                {
                        "path": "/home/<username_redacted>/code-server/workspace/folders"
                }
        ]
}

I get a new error:

ERROR SHARED stderr {"data":"Uncaught Exception:  Error: Cannot read property 'map' of undefined\n\nTypeError: Cannot read property 'map' of undefined\n    at pfs_1.readFile.then.contents (eval at exports.requireModule (/home/<username_redacted>/code-server/code-server-1.32.0-245-linux-x64/code-server:468:27660), <anonymous>:77278:76)\n    at <anonymous>\n    at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/home/<username_redacted>/code-server/code-server-1.32.0-245-linux-x64/code-server:468:27660), <anonymous>:52540:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)\n"}

I can confirm this happens in Container Linux/CoreOS stable as well, running on Digital Ocean (as well as Debian 9.7 as other have reported).

+1 running both on binary version and Dockerfile gives the same result. Ubuntu 16.04

it is working now with latest docker image. Thanks!

When using the docker command shown on the homepage, I’ve worked around this error by additionally mounting /root/.local to a path or a volume:

$ docker run -t -p 8443:8443 -v "$(pwd)/.coder:/root/.local" -v "$(pwd):/root/project" codercom/code-server code-server --allow-http --no-auth

Note: above command is insecure, use only for testing locally and always review the security documentation provided.

Cheers.

@ndom91 I tried creating the Backups folder with an empty workspace.json but now i get this: ERROR SHARED stderr {"data":"Uncaught Exception: Error: Unexpected end of JSON input\n\nSyntaxError: Unexpected end of JSON input\n at JSON.parse (<anonymous>)\n at pfs_1.readFile.then.contents (eval at exports.requireModule (/home/cj/vscode/code-server/code-server:468:27660), <anonymous>:77277:45)\n at <anonymous>\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/home/cj/vscode/code-server/code-server:468:27660), <anonymous>:52540:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

I guess i need a proper workspaces.json? What version are you using? Does anyone know whats in that file? Even better, does anyone have a default one that they can share?

@ndom91 what does your workspaces.json file look like? I’m having trouble finding an example and am receiving a cannot read property 'map' of undefined error with an empty workspaces.json file.

I just created an empty one, i.e. touch /home/[user]/.code-server/Backups/workspace.json

EDIT: I just looked at it, now that I’ve run this once or twice, and its still empty haha

Having the same issue when using the default Dockerfile.

ERROR SHARED stderr {"data":"Uncaught Exception: Error: ENOENT: no such file or directory, open '/root/.local/share/code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/.local/share/code-server/Backups/workspaces.json'\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:56921:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

If I manually create /root/.local/share/code-server/Backups/workspaces.json, it gives the following error:

ERROR SHARED stderr {"data":"Uncaught Exception: Error: Unexpected end of JSON input\n\nSyntaxError: Unexpected end of JSON input\n at JSON.parse (<anonymous>)\n at pfs_1.readFile.then.contents (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:81639:45)\n at <anonymous>\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:56921:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

@ndom91 what does your workspaces.json file look like? I’m having trouble finding an example and am receiving a cannot read property 'map' of undefined error with an empty workspaces.json file.

I get same error in Ubuntu 16.04 on AWS clouds

ubuntu@ip-172-31-25-334:~/coder$ sudo ./code-server -p 80 INFO code-server v1.0.0 INFO Additional documentation: http://github.com/codercom/code-server INFO Initializing {“data-dir”:“/home/ubuntu/.code-server”,“working-dir”:“/home/ubuntu/coder”,“log-dir”:“/home/ubuntu/.code-server/logs/20190309104304890”} INFO Starting shared process [1/5]… INFO Starting webserver… {“host”:“0.0.0.0”,“port”:80} WARN No certificate specified. This could be insecure. WARN Documentation on securing your setup: https://coder.com/docs INFO
INFO Password: fl4u1A3chFfj INFO
INFO Started (click the link below to open): INFO http://localhost:80/ INFO
INFO Connected to shared process ERROR SHARED stderr {“data”:“Uncaught Exception: Error: ENOENT: no such file or directory, open ‘/home/ubuntu/.code-server/Backups/workspaces.json’\n\nError: ENOENT: no such file or directory, open ‘/home/ubuntu/.code-server/Backups/workspaces.json’\n at Timeout.eval [as _onTimeout] (eval at exports.requireModule (/home/ubuntu/coder/code-server:468:27371), <anonymous>:71434:31)\n at ontimeout (timers.js:475:11)\n at tryOnTimeout (timers.js:310:5)\n at Timer.listOnTimeout (timers.js:270:5)\n”}

I pushed a commit which should resolve the JSON message, but it doesn’t cause any issues so you can safely ignore it until the next release.

Anyone found a workaround ?? This problem still exists Tried everything from specifying different folder to creating the file manually.

I always prefer binary file compared to docker. Seems like NO one is able to use the binary file installation.

Same here on Ubuntu 18.10 server via the binary.

However by specifying -d /home/[user]/.code-server and manually creating /home/[user]/.code-server/Backups/workspaces.json it seems to have worked!

@xuemind seems like your error is caused because the VM ran out of memory. You might need to add a gb or two of swap so the binary is able to boot properly without running our of memory. I was able to get it running on a GCP micro instance with 600mb of memory like this

Same error on Ubuntu 18.04 Digital Ocean standard vps while just trying to run binary version.

ERROR SHARED stderr {"data":"Uncaught Exception: Error: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'\n at Timeout.eval [as _onTimeout] (eval at exports.requireModule (/root/code-server-1.31.1-100-linux-x64/code-server:468:27371), <anonymous>:71445:31)\n at ontimeout (timers.js:475:11)\n at tryOnTimeout (timers.js:310:5)\n at Timer.listOnTimeout (timers.js:270:5)\n"}

This is the error I am currently getting on google cloud platform, with both Ubuntu 16 and 18 INFO Started (click the link below to open): INFO http://localhost:80/ INFO
INFO Starting shared process [1/5]… INFO Connected to shared process WARN Uncaught Exception: Error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at pfs_1.readFile.then.contents (/home/travis/build/codercom/code-server/packages/server/build/boo tstrap-fork.js.gz:77277:45) at <anonymous> at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/bui ld/bootstrap-fork.js.gz:52540:31) at ontimeout (timers.js:498:11) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:290:5) I have tried deleted and created new vms but its not working

it cannot be just empty file. try to put the contents that from my previous comment.

@tunnckoCore it’s not an empty and it is as your comment of content.

@yusef-ho try running mkdir -p /home/yusef/.code-server/User/workspaceStorage @kylecarbs yes, i did this before seeing reply, it worked perfectly, thanks

This issue is closed, is not a bug of code-server? I noticed that the code-server running normally, should I just ignore this error for now?

Aaaaah, heck. Forget it, just realized to try to disable the Brave’s Shields blocker 😄 Sometimes blocks too much, sometimes not enough.

This error doesn’t actually cause any issues. I would suspect the black terminal is caused by something else

I solved this in Docker on elementaryOS (Linux Desktop)

I tried the following docker-compose setup:

  vscode:
    image: codercom/code-server
    entrypoint: sh -c "mkdir -p /root/.local/share/code-server/Backups/ && touch /root/.local/share/code-server/Backups/workspaces.json && code-server --allow-http"
    expose:
      - 8443
    volumes:
      - /home/henry/development:/root/project
    restart: always
    networks:
      - vscode
    depends_on:
      - nginx-proxy

Notice I just overrode the entrypoint to make the file in question then run code-server

Yeah sorry I should have mentioned, I only have allow http because I have it behind a reverse proxy with nginx

I get this error when i try to run the binary on Ubuntu Server 18.04:

INFO code-server v1.0.0 INFO Additional documentation: http://github.com/codercom/code-server INFO Initializing {“data-dir”:“/home/cj/.code-server”,“working-dir”:“/var/www/dataandlogic.com”,“log-dir”:“/home/cj/.code-server/logs/20190312210351837”} INFO Starting webserver… {“host”:“0.0.0.0”,“port”:8443} WARN No certificate specified. This could be insecure. WARN Documentation on securing your setup: https://coder.com/docs WARN Launched without authentication. INFO INFO Started (click the link below to open): INFO http://localhost:8443/ INFO INFO Starting shared process [1/5]… INFO Connected to shared process

ERROR SHARED stderr {"data":"Uncaught Exception: Error: ENOENT: no such file or directory, open '/home/cj/.code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/home/cj/.code-server/Backups/workspaces.json'\n at Timeout.eval [as _onTimeout] (eval at exports.requireModule (/home/cj/vscode/code-server-1.31.0-20-x86_64-linux/code-server:468:27371), <anonymous>:71434:31)\n at ontimeout (timers.js:475:11)\n at tryOnTimeout (timers.js:310:5)\n at Timer.listOnTimeout (timers.js:270:5)\n"}

I also tried version 1.31.0-100 with same results. When i try to run the docker, it also gives me the same error.

Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1030-azure x86_64) Windows Azure Virtual Machine code-server-1.31.1-100-linux-x64

ERROR SHARED stderr {"data":"Uncaught Exception:  Error: ENOENT: no such file or directory, open '/home/<user>/.code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/home/<user>/.code-server/Backups/workspaces.json'\n    at Timeout.eval [as _onTimeout] (eval at exports.requireModule (/home/<user>/code-server-1.31.1-100-linux-x64/code-server:468:27371), <anonymous>:71445:31)\n    at ontimeout (timers.js:475:11)\n    at tryOnTimeout (timers.js:310:5)\n    at Timer.listOnTimeout (timers.js:270:5)\n"}
INFO  WebSocket opened / {"client":1,"ip":"<hoster_ip>"}
INFO  Created data directory
internal/child_process.js:323
    throw errnoException(err, 'spawn');
    ^
Error: spawn ENOMEM
    at _errnoException (util.js:1024:11)
    at ChildProcess.spawn (internal/child_process.js:323:11)
    at Object.exports.spawn [as _spawn] (child_process.js:502:9)
    at t.async (/home/<user>/code-server-1.31.1-100-linux-x64/code-server:716:35021)
    at e.exports (/home/<user>/code-server-1.31.1-100-linux-x64/code-server:716:34522)
    at e (/home/<user>/code-server-1.31.1-100-linux-x64/code-server:716:33324)
    at Timeout.c [as _onTimeout] (/home/<user>/code-server-1.31.1-100-linux-x64/code-server:716:33617)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)