atom / status-bar

Status bar for Atom
MIT License
100 stars 72 forks source link

Uncaught TypeError: Path must be a string. Received ~ #184

Closed petey closed 7 years ago

petey commented 7 years ago

[Enter steps to reproduce:]

  1. switch between open tabs

Atom: 1.14.2 x64 Electron: 1.3.13 OS: Mac OS X 10.12.3 Thrown From: status-bar package 1.7.0

Stack Trace

Uncaught TypeError: Path must be a string. Received undefined

At path.js:7

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1213:7)
    at Object.tildify (/app.asar/node_modules/status-bar/node_modules/fs-plus/lib/fs-plus.js:64:39)
    at /app.asar/node_modules/status-bar/lib/file-info-view.js:177:50)
    at /app.asar/node_modules/status-bar/lib/file-info-view.js:160:12)
    at /app.asar/node_modules/status-bar/lib/file-info-view.js:133:19)
    at /app.asar/node_modules/status-bar/lib/file-info-view.js:27:24
    at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at /app.asar/src/pane-container.js:348:27
    at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at Pane.module.exports.Pane.setActiveItem (/app.asar/src/pane.js:300:22)
    at Pane.module.exports.Pane.activateItem (/app.asar/src/pane.js:452:21)
    at TabBarView.module.exports.TabBarView.onMouseDown (/app.asar/node_modules/tabs/lib/tab-bar-view.js:678:19)

Commands

     -5:46.6.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-atom-dark-ui)

Non-Core Packages

atom-beautify 0.29.17 
atom-fuzzy-grep 0.15.0 
atom-lcov 2.0.0 
atom-pair 2.0.10 
atom-yamljson 0.2.3 
cucumber 0.6.0 
docblockr 0.9.1 
docker 0.7.0 
dockerletion 0.2.0 
editorconfig 2.2.1 
ember-cli-helper 0.9.0 
ember-tabs 2.4.1 
file-icons 2.0.15 
git-plus 7.2.2 
git-projects 1.17.0 
git-tab-status 1.9.2 
git-time-machine 1.5.6 
go-debug 1.0.4 
go-plus 5.1.1 
go-signature-statusbar 1.2.0 
highlight-selected 0.12.0 
javascript-snippets 1.2.1 
language-babel 2.54.1 
language-chef 0.9.0 
language-cucumber 0.0.1 
language-docker 1.1.7 
linter 1.11.23 
linter-csslint 1.3.3 
linter-docker 0.1.4 
linter-eslint 8.1.1 
linter-js-yaml 1.2.6 
linter-jshint 3.0.2 
linter-jsonlint 1.3.0 
markdown-scroll-sync 2.1.2 
merge-conflicts 1.4.4 
pigments 0.39.0 
project-colorize 0.2.0 
project-plus 0.9.0 
regex-railroad-diagram 0.16.0 
sort-lines 0.14.0 
symbols-tree-view 0.13.2 
sync-settings 0.8.1 
tabs-to-spaces 1.0.3 
todo-show 1.10.0 
petey commented 7 years ago

See also: https://github.com/atom/exception-reporting/issues/31

damieng commented 7 years ago

What is the name of the file you are editing when this happens? Atom is trying to display a relative version of the file path but at the final point it believes it doesn't have a path...

MikeMcElroy commented 7 years ago

I get this error when trying to edit any file, but here's an example: /Users/mikemac/Projects/blah-blah/app/utils/ActionUtils.js (my project is not actually blah-blah, but it does contain a hyphen, if that matters)

My search functionality is also completely shot. It finds nothing.

Atom: 1.14.3 x64 Electron: 1.3.13 OS: Mac OS X 10.12.2 Thrown From: exception-reporting package 0.41.0

Stack Trace

Uncaught TypeError: Path must be a string. Received undefined

At path.js:7

TypeError: Path must be a string. Received undefined
  at assertPath (path.js:7:11)
  at Object.join (path.js:1213:7)
  at Object.tildify (/app.asar/node_modules/exception-reporting/node_modules/fs-plus/lib/fs-plus.js:64:39)
  at /app.asar/node_modules/status-bar/lib/file-info-view.js:177:50)
  at /app.asar/node_modules/status-bar/lib/file-info-view.js:160:12)
  at /app.asar/node_modules/status-bar/lib/file-info-view.js:133:19)
  at /app.asar/node_modules/status-bar/lib/file-info-view.js:27:24
  at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
  at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
  at /app.asar/src/pane-container.js:348:27
  at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
  at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
  at Pane.module.exports.Pane.setActiveItem (/app.asar/src/pane.js:300:22)
  at Pane.module.exports.Pane.activateItemAtIndex (/app.asar/src/pane.js:435:19)
  at Pane.module.exports.Pane.activatePreviousItem (/app.asar/src/pane.js:400:21)
  at Pane.module.exports.Pane.removeItem (/app.asar/src/pane.js:585:16)
  at Pane.module.exports.Pane.destroyItem (/app.asar/src/pane.js:658:16)
  at TabBarView.module.exports.TabBarView.closeTab (/app.asar/node_modules/tabs/lib/tab-bar-view.js:333:26)
  at HTMLDivElement.TabView.didClickCloseIcon (/app.asar/node_modules/tabs/lib/tab-bar-view.js:222:19)

Commands

     -3:48.1.0 application:open (a.btn-issue.btn.btn-error)
     -3:42.7.0 find-and-replace:show (input.hidden-input)
     -3:38.7.0 editor:consolidate-selections (input.hidden-input)
     -3:38.7.0 core:cancel (input.hidden-input)
     -3:35.3.0 find-and-replace:show (input.hidden-input)
  2x -3:34.3.0 core:move-right (input.hidden-input)
  6x -3:32.9.0 core:backspace (input.hidden-input)
     -3:08.0 find-and-replace:show (input.hidden-input)
     -3:06.7.0 core:confirm (input.hidden-input)
     -3:06.0 editor:consolidate-selections (input.hidden-input)
     -3:06.0 core:cancel (input.hidden-input)
     -2:51 nuclide-file-tree:copy-full-path (span.)
     -0:06.3.0 find-and-replace:show (input.hidden-input)
  3x -0:04.7.0 core:confirm (input.hidden-input)
     -0:03.8.0 core:select-all (input.hidden-input)
     -0:03.6.0 core:backspace (input.hidden-input)

Non-Core Packages

autocomplete-modules 1.6.7 
language-javascript-jsx 0.3.7 
linter 1.11.18 
linter-eslint 8.0.0 
linter-js-standard 3.6.0 
nuclide 0.184.0 
CodingAnarchy commented 7 years ago

Is there any progress on fixing this? It's made Atom virtually unusable for me.

damieng commented 7 years ago

We've never been able to repro this but I have increased the error handling based on the stack trace. I just merged it into master and might be able to get it into the next beta hotfix.

mariagwyn commented 7 years ago

I have been having this problem with increasing frequency, and Atom is becoming unusable. I can't save (via the keyboard), I can't click closed, I can't switch to new documents.

atomhell

damieng commented 7 years ago

Can you try the latest version of status-bar to let us know if this avoids the problem?

You'll need to type the following commands into a command prompt/terminal window;

apm dev status-bar
atom -d

This will start atom in developer mode which will load apm dev packages. Let me know if you are still able to repro the issue there or if it goes away.

Thanks!

kremalicious commented 7 years ago

I had this problem too throughout the Atom 1.15.x x64 stable releases on macOS 10.12.3. Disabled status-bar package to get through that.

But I wasn't able to reproduce this bug since running Atom 1.16.0-beta0 x64 on macOS 10.12.3, which has status-bar v1.8.3 included. So seems one of the newer status-bar releases makes this go away.

damieng commented 7 years ago

Hmm, that is strange. My workaround is in 1.8.5 which isn't in 1.16 either. But it was just that - a workaround as I cound't find a path that would have gotten an undefined to that point in the code. If it was fixed sometime between 1.8.1 and 1.8.3 that might explain why.

mariagwyn commented 7 years ago

So the problem appears inconsistently, so I cannot say with confidence that running atom -d works ALL the time, but it certainly appears to do so. In one case, I opened a directory without -d and the error appeared almost immediately. Reopening with -d made it all pretty and functional again.

aneilbaboo commented 7 years ago

I've been having this problem with 1.15.0 for maybe 2 weeks (very rough estimate), and @damieng's fix worked for me.

Pysis868 commented 7 years ago

Still having this issue on a Mac 10.12.3 with Atom 1.17.2 and status-bar 1.8.7.

Do I still need the dev package upgrade mentioned by damieng on Mar 22?

damieng commented 7 years ago

You should apm unlink that package now. Not sure why you're still having the issue though. Can you post the stack trace?

Pysis868 commented 7 years ago

I didn't perform any specific actions to that package. Should I bother unlinking it? Also, it is not linked in the packages folder:

⋊> ~ ls "$HOME/.atom/packages/"*status-bar*
No matches for wildcard '"$HOME/.atom/packages/"*status-bar*'.  (Tip: empty matches are allowed in 'set', 'count', 'for'.)
fish: ls "$HOME/.atom/packages/"*status-bar*
         ^
⋊> ~ apm links
/Users/username/.atom/dev/packages (0)
└── (no links)
/Users/username/.atom/packages (0)
└── (no links)

Error Report

  1. Re-enabled package
  2. Switched tabs in right-hand vertical pane.

Atom: 1.17.2 x64 Electron: 1.3.15 OS: Mac OS X 10.12.3 Thrown From: status-bar package 1.8.7

Stack Trace

Uncaught TypeError: Path must be a string. Received undefined

At path.js:7

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1213:7)
    at Proxy.tildify (/Applications/Atom.app/Contents/Resources/app/node_modules/fs-plus/lib/fs-plus.js:71:1)
    at FileInfoView.module.exports.FileInfoView.updatePathText (/Applications/Atom.app/Contents/Resources/app/node_modules/status-bar/lib/file-info-view.js:177:1)
    at FileInfoView.module.exports.FileInfoView.update (/Applications/Atom.app/Contents/Resources/app/node_modules/status-bar/lib/file-info-view.js:159:1)
    at FileInfoView.module.exports.FileInfoView.subscribeToActiveItem (/Applications/Atom.app/Contents/Resources/app/node_modules/status-bar/lib/file-info-view.js:132:1)
    at /Applications/Atom.app/Contents/Resources/app/node_modules/status-bar/lib/file-info-view.js:26:1
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:1)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:1)
    at Workspace.didChangeActivePaneItemOnPaneContainer (/Applications/Atom.app/Contents/Resources/app/src/workspace.js:489:1)
    at WorkspaceCenter.paneContainer.onDidChangeActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace-center.js:16:1)
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:1)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:1)
    at PaneContainer.didChangeActiveItemOnPane (/Applications/Atom.app/Contents/Resources/app/src/pane-container.js:280:1)
    at Pane.module.exports.Pane.setActiveItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:318:1)
    at Pane.module.exports.Pane.activateItemAtIndex (/Applications/Atom.app/Contents/Resources/app/src/pane.js:454:1)
    at Pane.module.exports.Pane.activateNextItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:411:1)
    at atom-workspace.pane:show-next-item (/Applications/Atom.app/Contents/Resources/app/src/register-default-commands.js:24:1)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:1)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:1
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:1)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:1)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:1)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:1)

Commands

  2x -0:15.8.0 pane:show-next-item (input.hidden-input)
     -0:13.3.0 pane:show-previous-item (input.hidden-input)

Non-Core Packages

0-env 1.0.1 
000-project-shell-env 0.3.0 
activate-power-mode 1.4.0 
advanced-open-file 0.16.6 
aesthetic-ui 3.0.1 
an-old-hope-syntax 1.0.4 
atom-beautify 0.29.24 
atom-clock 0.1.7 
atom-css-clean 2.19.6 
atom-ctags 5.0.0 
atom-material-syntax 1.0.3 
atom-material-ui 1.3.10 
atom-no-tab-close-button 1.0.0 
atom-prettify 0.1.3 
atom-rails-debugger 0.2.1 
aurora-theme 1.2.2 
autocomplete-ruby 0.2.8 
build 0.67.0 
busy 0.7.0 
busy-signal 1.4.1 
css-clean 2.15.0 
cucumber 0.6.0 
cucumber-autocomplete 0.7.2 
custom-title 1.0.1 
debug 0.0.1 
environment 1.3.1 
expose 0.14.0 
file-icons 2.1.4 
fold-lines 0.2.2 
genesis-ui 0.5.0 
git-diff-details 1.4.0 
git-plus 7.8.0 
git-time-machine 1.5.9 
gitignore-snippets 0.2.5 
go-to-definition-rails 2.2.0 
goto 1.8.3 
goto-definition 1.3.3 
hashrocket 0.4.10 
highlight-selected 0.13.1 
intentions 1.1.2 
javascript-snippets 1.2.1 
language-dots 0.0.4 
language-fish-shell 1.0.5 
language-markdown 0.22.0 
levels 0.5.1 
levels-debugger-ruby 0.2.7 
levels-language-ruby 0.5.2 
linter 2.1.4 
linter-erb 1.1.0 
linter-js-yaml 1.2.7 
linter-markdown 4.0.1 
linter-rails-best-practices 0.2.2 
linter-rubocop 2.1.1 
linter-sass-lint 1.7.4 
linter-tidy 2.3.1 
linter-ui-default 1.2.4 
linter-xo 0.23.0 
markdown-deluxe 1.0.0 
markdown-document 0.2.1 
markdown-folder 0.5.0 
markdown-folding 0.1.0 
markdown-helpers 0.3.0 
markdown-mindmap 0.3.3 
markdown-preview-plus 2.4.9 
markdown-scroll-sync 2.1.2 
markdown-themeable-pdf 1.2.0 
markdown-toc 0.4.2 
markdown-writer 2.6.5 
maybs-quit 1.3.0 
merge-conflicts 1.4.4 
minimap 4.28.2 
minimap-autohide 0.10.1 
minimap-bookmarks 0.4.2 
minimap-codeglance 0.4.6 
minimap-cursorline 0.2.0 
minimap-find-and-replace 4.5.2 
minimap-git-diff 4.3.1 
minimap-highlight-selected 4.6.1 
minimap-linter 2.0.0 
minimap-pigments 0.2.2 
minimap-selection 4.4.0 
minimap-split-diff 0.3.7 
minimap-titles 1.11.0 
multirow-tabs 0.3.3 
node-debugger 1.10.1 
octocat-syntax 1.3.1 
pigments 0.39.1 
plist-converter 0.1.6 
pretty-json 1.6.3 
pumpkin-syntax 0.1.0 
qolor 0.4.1 
rails-i18n-autocomplete 0.4.0 
rails-rspec 0.3.2 
rails-snippets 2.15.0 
rails-transporter 1.6.5 
robin-hood-syntax 1.0.0 
ruby-block 0.3.6 
ruby-test 1.0.2 
script 3.14.1 
script-runner 2.1.1 
seeing-is-believing 2.2.3 
seti-icons 1.4.3 
seti-ui 1.7.0 
split-diff 1.3.0 
Sublime-Style-Column-Selection 1.7.4 
tab-title 0.3.3 
test 0.1.2 
test-status 1.0.0 
tidy-tabs 0.4.0 
todo-list 1.0.0 
toggle-markdown-task 0.6.0 
turbo-javascript 1.4.0 
vim-mode 0.66.0 
xml-formatter 0.10.0 
zentabs 0.8.8 
damieng commented 7 years ago

Sorry I thought you already had performed the steps. They should no longer be necessary but it seems the problem still exists.

Could you open a debug window in your atom (View > Developer > Toggle Developer Tools) and type this in the console window and then paste the results back here;

process.env.HOME
Pysis868 commented 7 years ago

Cmd+Alt+i still works. ;P

> process.env.HOME
<• undefined

Not much there =/ But there *is* this:

> process.env
<• ▼ Object {ATOM_HOME: "/Users/username/.atom", NODE_PATH: "/Applications/Atom.app/Contents/Resources/app/exports", NODE_ENV: "production", ]1337;RemoteHost: "username@computer]1337;CurrentDir=/]1337;ShellIntegrationVersion=2;shell=fish"}
       ]1337;RemoteHost: "username@computer]1337;CurrentDir=/]1337;ShellIntegrationVersion=2;shell=fish"
       ATOM_HOME: "/Users/username/.atom"
       NODE_ENV: "production"
       NODE_PATH: "/Applications/Atom.app/Contents/Resources/app/exports"
     ▶ __proto__: Object

I can also reproduce the issue when switching the active tab focus between panes.

damieng commented 7 years ago

The fact it is undefined is important. Can you open a Terminal window and type;

export | grep HOME

And let me know if it outputs anything.

Pysis868 commented 7 years ago
GEM_HOME /Users/username/.rvm/gems/ruby-2.0.0-p648
HOME /Users/username

By the way, I also just tried:

  1. Disabled the now deprecated atom-community/environment package.
  2. Restarted Atom.
  3. Re-enabled the status-bar package.

and still received the error.

damieng commented 7 years ago

So you have a HOME system environment variable but it's being wiped out at some point in the Atom environment.

Can you try atom in safe mode? atom --safe and see if process.env.HOME is set?

Pysis868 commented 7 years ago
⋊> ~ atom --safe
> process.env.HOME
<• "/Users/username"

Any advice for efficiently checking which package is doing this? Would the method be as simple as disabling all, enabled status-bar, and enabling others incrementally until I find the variable is overwritten? Do I need to restart Atom each time?

damieng commented 7 years ago

There are a couple of other ones in your list with 'env' in the name that might be interfering. Disabling and re-enabling is the only real way although you can do it by disabling half and testing. If it doesn't solve the problem disable half the others, if it does then enable half the ones you disabled. Technically this would be overall quicker than doing them one at a time. (binary search)

e1senh0rn commented 7 years ago

I have similar issue. If I run Atom from Finder process.env.HOME is undefined. I believe that Finder sets clean environment (it has only ATOM_HOME, NODE_ENV, NODE_PATH).

Launching Atom from terminal keeps the proper environment.

damieng commented 7 years ago

I have a fix over in https://github.com/atom/fs-plus/pull/42 that will avoid this scenario and error.