github
github copied to clipboard
Uncaught TypeError: Cannot read property 'getPath' of undefined
Steps to Reproduce
- Open a project containing a git repository
- Make changes to a file
- Click the changed file in the Git tab, the diff view does not appear
- Explicitly trigger the
View Unstaged Changes For Current File
command, which provides the error below
I've tried safe mode, a clean install, different project in a different repository... everything results in the same error and no change diffs.
Atom: 1.18.0 x64 Electron: 1.3.15 OS: Mac OS X 10.12.5 Thrown From: github package 0.3.3
Stack Trace
Uncaught TypeError: Cannot read property 'getPath' of undefined
At /Applications/Atom.app/Contents/Resources/app/node_modules/github/lib/controllers/root-controller.js:790
TypeError: Cannot read property 'getPath' of undefined
at RootController.viewChangesForCurrentFile (/Applications/Atom.app/Contents/Resources/app/node_modules/github/lib/controllers/root-controller.js:790:37)
at RootController.viewUnstagedChangesForCurrentFile (/Applications/Atom.app/Contents/Resources/app/node_modules/github/lib/controllers/root-controller.js:812:16)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:106:35)
at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:313:26)
at HTMLDivElement.core:confirm (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:81:20)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:28)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)
Commands
-1:17.3.0 core:close (ul.list-inline.tab-bar.inset-panel)
-1:15 application:open (ul.list-inline.tab-bar.inset-panel)
-1:06.5.0 window:toggle-dev-tools (atom-pane.pane.active)
-0:45.9.0 application:open (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)
-0:36.9.0 github:toggle-github-tab (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)
-0:25.8.0 core:save (input.hidden-input)
-0:21.9.0 core:close (div.github-StagingView.unstaged-changes-focused)
-0:21 command-palette:toggle (div.github-StagingView.unstaged-changes-focused)
-0:18.6.0 core:confirm (input.hidden-input)
-0:18.5.0 github:view-unstaged-changes-for-current-file (div.github-StagingView.unstaged-changes-focused)
Non-Core Packages
Thanks for the report! Do you get the error for changes to any file? Also, can you share the path for a file that triggers the error?
Oh sorry one more question - can you also reproduce in safe mode (atom --safe
)?
I tried multiple projects and files in those projects (all backed by git repositories). The only thing they had in common was a base directory of /Users/dana/
.
And yes, I tried safe mode as well as a clean install of atom, all with the same results.
And yes, I tried safe mode as well as a clean install of atom, all with the same results.
Oy sorry, I spaced that you totally mentioned that in your original report sorry about that!
I poked at this a bit more and see that I can reproduce if I execute GitHub: View Unstaged Changes For Current File
while the focus is on the Git tab, then I can generate this error. I think at your step 3, we're focusing the Git tab so there's no active editor which causes the error? If I click back into the file with changes and execute GitHub: View Unstaged Changes For Current File
, it works ok.
Though I guess another issue in your case is this?
- Make changes to a file
- Click the changed file in the Git tab, the diff view does not appear
Assuming you're saving the file after (2), I'm not sure why the diff view doesn't appear in this case. Are there console errors at this point?
No worries! It was sort of sandwiched in-between everything else. I can verify that same behavior of when a file is focused in the editor, versus when it's not.
There actually are console errors at that point, which I should have checked for. I must have missed them when I assumed that invoking GitHub: View Unstaged Changes For Current File
without a file selected in the editor was the source of the problem.
Those errors actually led me to finding out the root of my problem is a duplicate of https://github.com/atom/github/issues/977
At least there's still an uncaught exception that can be taken care of? Anyway, thanks for the help, and sorry for taking away some of your valuable time!
Those errors actually led me to finding out the root of my problem is a duplicate of #977
Ahhh great, glad you found that one, that explains things.
At least there's still an uncaught exception that can be taken care of?
:+1: I think that's still a bug so we can leave this open.
Thanks again for reporting :v:
Sure thing!
It's nothing compared to the great work you guys do at GitHub.
Hey there fellow tentacools,
Just an update: I got the same error without Git's color piping config involved (at least not from my local tinkering).
I have a different version of Atom, and this all occurred in a temp directory with Git init ran from Atom (I'm really loving how streamlined this is, but I digress).
The error report popup said the issue was already known and linked me here.
Since I had checked and found, after reading through #977, that my issue's cause was apparently not the same, I decided to include the error report here.
Thanks, ion
Steps to Reproduce
When one octocat likes another octocat--wrong list. Here we go: Beginning in BASH and transitioning to Atom:
-
MYDIR=$(mktemp -d)
-
cd $MYDIR
-
touch somethingNew
-
atom .
-
ctrl
+shift
+9
- Click
Create repository
button -
ctrl
+shift
+p
- Type 'unstaged'
-
enter
Atom: 1.19.2 x64 Electron: 1.6.9 OS: Ubuntu 16.04.3 Thrown From: github package 0.3.4-1
Stack Trace
Uncaught TypeError: Cannot read property 'getPath' of undefined
At /usr/share/atom/resources/app/node_modules/github/lib/controllers/root-controller.js:790
TypeError: Cannot read property 'getPath' of undefined
at RootController.viewChangesForCurrentFile (/usr/share/atom/resources/app/node_modules/github/lib/controllers/root-controller.js:790:37)
at RootController.viewUnstagedChangesForCurrentFile (/usr/share/atom/resources/app/node_modules/github/lib/controllers/root-controller.js:812:16)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:265:35)
at /usr/share/atom/resources/app/src/command-registry.js:3:65
at Object.didConfirmSelection (/usr/share/atom/resources/app/node_modules/command-palette/lib/command-palette-view.js:106:35)
at SelectListView.confirmSelection (/usr/share/atom/resources/app/node_modules/atom-select-list/src/select-list-view.js:313:26)
at HTMLDivElement.core:confirm (/usr/share/atom/resources/app/node_modules/atom-select-list/src/select-list-view.js:81:20)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:265:35)
at /usr/share/atom/resources/app/src/command-registry.js:3:65
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:28)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app/src/window-event-handler.js:100:42)
at HTMLDocument.<anonymous> (/usr/share/atom/resources/app/src/window-event-handler.js:3:65)
Commands
-0:26.6.0 github:toggle-git-tab (atom-pane.pane.active)
-0:11.2.0 command-palette:toggle (atom-workspace.workspace.scrollbars-visible-always.theme-one-light-syntax.theme-one-light-ui)
-0:08.2.0 core:confirm (input.hidden-input)
-0:08.2.0 github:view-unstaged-changes-for-current-file (atom-workspace.workspace.scrollbars-visible-always.theme-one-light-syntax.theme-one-light-ui)
Non-Core Packages
I can reproduce this when nothing is open or when the unstaged changes tab is open but not when the git tab is focused.
I have been seeing warnings on 1.57.0 on file moves/renames in a freshly created repo (freshly imaged computer) as well but not seeing any of the major errors but can reproduce most of the warnings with 100% consistency.
Atom
Atom : 1.57.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1
Installed packages
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
https://github.com/atom/atom/issues/22542 and https://github.com/atom/atom/issues/22686 are possibly related.
Steps To Reproduce:
- New, Unpublished GitHub repo
- On files open or previewed (within the scope of a GitHub repo) within Atom, you will receive a
Cannot read property 'getPath' of undefined
on/after moving or renaming that file. - If the file is not open or previewed in Atom, and you right click to rename from the Project file list or drag and drop files around without allowing Atom to preview or open the file, then zero errors/warnings are produced.
An additional set of behaviors to note:
- You can open and rename files within the same editor but outside of the scope of the project, then right click to rename from the editor tab without any errors. If you do the same on a file within the scope of the folder/project repo you may find more quirky behavior:
- Doing the same on a file within the scope of the project, you receive a warning and file renaming occurs otherwise. However attempting to rename the file the same way a second time produces no rename prompts until you defocus/refocus the file.
// updated for some extra clarity.
Been hitting this same issue on macOS, when a file/folder is renamed Atom throws the getPath is undefined
error but will execute the rename despite the error. Don't suppose anyone has a workaround yet?
Atom : 1.57.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1
Same error here on macOS. And exact same versions as @jmooo.
Yo Got the error here too while moving/renaming files
- Linux 20.04
- Atom v1.54
Packages
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
+1 except for me, I was not having this issue until I switched to a new Macbook due to a battery issue and tried copying my home directory from the old to new one, but got interrupted midway and did not get the whole $HOME/.atom
directory. Reinstalling packages did not help & FYI Atom was installed on the new mac AFTER the copy attempt.
Versions:
Atom : 1.58.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1
apm 2.6.2
npm 6.14.13
node 12.14.1 x64
atom 1.58.0
python 2.7.16
git 2.30.1
Installed community packages:
├── [email protected]
├── atom-ide-ui
├── [email protected]
├── [email protected]
├── go-signature-statusbar
├── language-vbscript
├── refactor
└── [email protected]
Issue for me occurs as others have identically mentioned, whenever renaming or moving a file within the editor; though the rename/move operation still gets carried out despite the warning.
Edit: it's still happening. @lech 's answer explains some behavior: https://github.com/atom/github/issues/964#issuecomment-873461105
My previous answer solves the r trim() issue: https://github.com/atom/markdown-preview/issues/579#issuecomment-902387642
Issues (22 Aug 2021) related to getPath() error:
@lech mentioned:
https://github.com/atom/atom/issues/22542
https://github.com/atom/atom/issues/22686#issue-935562185
Here's another I found:
https://github.com/atom/atom/issues/22720#issue-942225379
Running into this with Atom 1.58.0, Windows 10. I renamed lots of files over the course of an Atom session, and after ignoring warning after warning eventually one of my renames crashed Atom altogether. Installed community packages:
hexit 1.0.2
mcfunction-lang 1.16.2-snapshot
Still finding this behavior on 1.58.0
@lech @W-19 Thanks for the updates. It was working for a bit and now I'm still getting that error...
This might have been fixed in https://github.com/atom/atom/pull/22543. Just hasn't reached a stable version of atom yet.
This might have been fixed in atom/atom#22543. Just hasn't reached a stable version of atom yet.
This PR was merged in June 7, Atom 1.58 was released in July 27, the issue is still in Atom 1.58… I doubt.
@AlexWayfer https://github.com/atom/atom/releases/tag/v1.58.0 this.editorPath = this.edtior.getPath();
in source code.
Oh, I found https://github.com/atom/atom/issues/22720#issue-942225379, yes, somehow this PR was out of 1.58, that's weird.