Tools: ๐Ÿ› Cannot construct a FilePath with zero segments

Created on 8 Aug 2020  ยท  8Comments  ยท  Source: rome/tools


Environment

$ rome rage --summary
Environment Variables
  Object {
    COLORTERM: "truecolor"
    LANG: "C.UTF-8"
    PATH: "/tmp/xfs-89ae1f4f:/tmp/fnm-shell-5096683/bin:/home/hampus/.fnm:/home/hampus/.vscode-server/bin/91899dc
    ef7b8110878ea59626991a18c8a6a1b3e/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    :/usr/local/games:/mnt/c/Users/hampus/AppData/Local/Programs/Python/Python38/Scripts/:/mnt/c/Users/hampus/App
    Data/Local/Programs/Python/Python38/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt
    /c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program
    Files/PostgreSQL/12/bin:/mnt/c/Users/hampus/.windows-build-tools/python27/:/mnt/c/Users/hampus/AppData/Local/
    Microsoft/WindowsApps:/mnt/c/Users/hampus/AppData/Roaming/nvm:/mnt/c/Program
    Files/nodejs:/mnt/c/Users/hampus/.dotnet/tools:/mnt/c/Users/hampus/.deno/bin:/mnt/c/Users/hampus/AppData/Loca
    l/Programs/Microsoft VS Code/bin:/mnt/c/Users/hampus/AppData/Local/Microsoft/WindowsApps:/snap/bin"
    TERM: "xterm-256color"
    TERM_PROGRAM: "vscode"
    USER: "hampus"
  }

User Config
  unset

Rome Version
  10.0.3-beta

Node Version
  14.7.0

Platform
  linux x64 4.4.0-18362-Microsoft

Terminal Features
  Object {
    background: "unknown"
    colorDepth: 24
    columns: 117
    cursor: true
    hyperlinks: true
    isTTY: true
    unicode: true
  }

Client Flags
  Object {
    clientName: "cli"
    cwd: "/home/hampus/my-project"
    realCwd: "/home/hampus/my-project"
    silent: false
  }

Server Status
  Object {
    projects: Array [
      Object {id: 0}
      Object {id: 1}
    ]
    server: Object {
      heapTotal: 27_443_200
      pid: 18_404
      uptime: 0.4760594
    }
    workers: Array [
      Object {
        astCacheSize: 0
        heapTotal: 27_443_200
        ownedBytes: 0
        ownedFileCount: 0
        pid: 18_404
        uptime: 0.4756293
      }
    ]
  }

Steps To Reproduce


There are unfortunately no clear steps to reproduce for this issue, but Sebastian mentioned in Discord that he probably can figure it out just from the stacktrace, so here it is:

 project-rome/@internal/path/index.ts:36:9 internalError/request  INTERNAL  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

  โœ– Cannot construct a FilePath with zero segments

  13. new ___R$$priv$project$rome$$internal$path$index_ts$BaseFilePath.
      ___R$$priv$project$rome$$internal$path$index_ts$BaseFilePath (project-rome/@internal/path/index.ts:36:9)
  14. ___R$$priv$project$rome$$internal$path$index_ts$createUnknownFilePathFromSegments (
      project-rome/@internal/path/index.ts:853:14)
  15. ___R$project$rome$$internal$path$index_ts$createUnknownFilePath (project-rome/@internal/path/index.ts:902:8)
  16. ___R$project$rome$$internal$codec$js$manifest$dependencies_ts$parseDependencyPattern (
      project-rome/@internal/codec-js-manifest/dependencies.ts:469:2)
  17. ___R$project$rome$$internal$codec$js$manifest$dependencies_ts$normalizeDependencies (
      project-rome/@internal/codec-js-manifest/dependencies.ts:515:16)
  18. ___R$project$rome$$internal$codec$js$manifest$index_ts$normalizeManifest (
      project-rome/@internal/codec-js-manifest/index.ts:673:19)
  19. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.
      declareManifestWithPossibleDiagnosticsThrow (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:656:12
      )
  20. ___R$project$rome$$internal$diagnostics$wrap_ts$catchDiagnostics (
      project-rome/@internal/diagnostics/wrap.ts:29:16)
  21. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.declareManifest (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:627:24)
  22. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addFile (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:926:3)
  23. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:760:4)
  24. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:771:5)
  25. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  26. Function.all
  27. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  28. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  29. Function.all
  30. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  31. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.createWatcher (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:297:3)
  32. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.watch (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:537:23)
  and 12 others...

  โš  This diagnostic was derived from an internal Rome error. Potential bug, please report if necessary.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

โœ– Found 1 problem

The above stacktrace is a result of running rome check in a project with an unknown conflicting package in my node_modules folder. Running the same command with the --logs flag doesn't appear to give any helpful details, since when the error is thrown, none of the recently logged packages appear to have abnormal package.json files.

Expected Results


I expected an error to not be thrown.

unconfirmed

Most helpful comment

Yeah it will, I'll do the release early tomorrow. Don't have time to do it tonight.

All 8 comments

getting the same issue in one of my repos. Happy to help dig into this with some direction.

node version 14.4.0
platform darwin x64 19.5.0

Duplicate of https://github.com/romefrontend/rome/issues/991 and https://github.com/romefrontend/rome/issues/994

Maybe there's some filename with ~ character

I have the same issue.
Node v12.18.3 (via nvm)
Ubuntu 20.04.1

I have the same issue with Node v14.3.0 and all [email protected] versions so far.

Trying to add it to an existing project with lots of dependencies in node_modules.

React, Jest, Storybook, etc.

Here's another set of logs in case it's helpful:

$ rome rage --summary
Environment Variables
  Object {
    COLORTERM: "truecolor"
    LANG: "en_US.UTF-8"
    PATH: "/Users/bdowling/Dev/d3-playground/node_modules/.bin:/Users/bdowling/.yarn/bin:/Users/bdowling/.config/yarn/global/node_modules/.b
    in:/Users/bdowling/.nvm/versions/node/v13.11.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/bdowling/.yarn/bin:/
    Users/bdowling/.config/yarn/global/node_modules/.bin:/Users/bdowling/.nvm/versions/node/v13.11.0/bin:/usr/local/opt/fzf/bin:/Users/bdowl
    ing/go/bin:/Users/bdowling/go/bin"
    TERM: "xterm-256color"
    TERM_PROGRAM: "vscode"
    USER: "bdowling"
  }

User Config
  unset

Rome Version
  10.0.3-beta

Node Version
  13.11.0

Platform
  darwin x64 18.7.0

Terminal Features
  Object {
    background: "unknown"
    colorDepth: 24
    columns: 144
    cursor: true
    hyperlinks: true
    isTTY: true
    unicode: true
  }

Client Flags
  Object {
    clientName: "cli"
    cwd: "/Users/bdowling/Dev/d3-playground"
    realCwd: "/Users/bdowling/Dev/d3-playground"
    silent: false
  }

Server Status
  Object {
    projects: Array [
      Object {id: 0}
      Object {id: 1}
    ]
    server: Object {
      heapTotal: 26_361_856
      pid: 87_868
      uptime: 0.199454687
    }
    workers: Array [
      Object {
        astCacheSize: 0
        heapTotal: 26_361_856
        ownedBytes: 0
        ownedFileCount: 0
        pid: 87_868
        uptime: 0.199402725
      }
    ]
  }

Stack trace:

$ npx rome check

 project-rome/@internal/path/index.ts:721:8 internalError/request  INTERNAL  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

  โœ– Cannot construct a FilePath with zero segments

  12. ___R$$priv$project$rome$$internal$path$index_ts$parsePathSegments (project-rome/@internal/path/index.ts:721:8)
  13. ___R$project$rome$$internal$path$index_ts$RelativeFilePath.getUnique (project-rome/@internal/path/index.ts:400:21)
  14. ___R$project$rome$$internal$path$collections_ts$RelativeFilePathMap.set (project-rome/@internal/path/collections.ts:74:21)
  15. set (project-rome/@internal/codec-js-manifest/index.ts:475:10)
  16. ___R$project$rome$$internal$codec$js$manifest$index_ts$normalizeManifest (project-rome/@internal/codec-js-manifest/index.ts:670:11)
  17. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.declareManifestWithPossibleDiagnosticsThrow (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:656:12)
  18. ___R$project$rome$$internal$diagnostics$wrap_ts$catchDiagnostics (project-rome/@internal/diagnostics/wrap.ts:29:16)
  19. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.declareManifest (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:627:24)
  20. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addFile (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:926:3)
  21. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:760:4)
  22. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:771:5)
  23. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  24. Function.all
  25. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  26. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  27. Function.all
  28. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  29. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.createWatcher (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:297:3)
  30. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.watch (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:537:23)
  31. ___R$project$rome$$internal$core$server$project$ProjectManager_ts$default.findProject (
      project-rome/@internal/core/server/project/ProjectManager.ts:891:5)
  and 11 others...

  โš  This diagnostic was derived from an internal Rome error. Potential bug, please report if necessary.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

โœ– Found 1 problem

Maybe it doesn't like dashes in the directory name?

Update: Just made a new directory with no dashes in it and got the same error. This time it was with a global install so that (local install vs global) is likely not the cause either.

Fix should be in #1027.

@sebmck will this be in v10.0.4-beta ? I could test it again.

Yeah it will, I'll do the release early tomorrow. Don't have time to do it tonight.

Was this page helpful?
0 / 5 - 0 ratings