Error on reload but not startup: Failed to execute 'createNodeIterator' on 'Document'


#1

I am getting the following error when I try to trigger my package after I reload Atom (i.e., window:reload). My package is a React-based autocomplete widget, so it includes the line var React = require('react-atom-fork');, though I don’t think React has anything to do with this error. When I hit ctrl-space to activate my package, the error occurs, but from the trace, I think it’s an issue with the use of React in Atom’s editor. The version string from the About dialog is: Version 0.121.0-acf5ab8 (0.121.0-acf5ab8). This is built from source.

Note that if I quit Atom and start from scratch, everything works fine. The issue arises only when I window:reload.

Failed to activate package named 'test' Error: Failed to execute 'createNodeIterator' on 'Document': The 1st argument provided is either null, or an invalid Node object.
  at Error (native)
  at [object Object].module.exports.React.createClass.measureCharactersInLine (/Applications/Atom.app/Contents/Resources/app/src/lines-component.js:436:35)
  at [object Object].boundMethod [as measureCharactersInLine] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at /Applications/Atom.app/Contents/Resources/app/src/lines-component.js:410:21
  at DisplayBuffer.module.exports.DisplayBuffer.batchCharacterMeasurement (/Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:436:7)
  at Editor.module.exports.Editor.batchCharacterMeasurement (/Applications/Atom.app/Contents/Resources/app/src/editor.js:2091:33)
  at [object Object].module.exports.React.createClass.measureCharactersInNewLines (/Applications/Atom.app/Contents/Resources/app/src/lines-component.js:402:21)
  at [object Object].boundMethod [as measureCharactersInNewLines] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at [object Object].module.exports.React.createClass.remeasureCharacterWidths (/Applications/Atom.app/Contents/Resources/app/src/lines-component.js:395:19)
  at [object Object].boundMethod [as remeasureCharacterWidths] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at [object Object].module.exports.React.createClass.remeasureCharacterWidths (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:1435:32)
  at [object Object].boundMethod [as remeasureCharacterWidths] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at [object Object].module.exports.React.createClass.onStylesheetsChanged (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:1223:19)
  at boundMethod (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at ThemeManager.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/emissary/lib/emitter.js:118:15)
  at ThemeManager.module.exports.ThemeManager.applyStylesheet (/Applications/Atom.app/Contents/Resources/app/src/theme-manager.js:341:12)
  at Package.module.exports.Package.activateStylesheets (/Applications/Atom.app/Contents/Resources/app/src/package.js:197:21)
  at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app/src/package.js:161:14)
  at Package.module.exports.Package.handleActivationEvent (/Applications/Atom.app/Contents/Resources/app/src/package.js:551:12)
  at HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/package.js:3:61)
  at HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
  at HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:400:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:181:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:142:20)

#2

Updated to Version 0.122.0-c6fc0d0 (0.122.0-c6fc0d0) and the problem still exists.


#3

OK, I believe I figured it out! I had a tab open to a file that no longer exists. It existed in a previous Git branch, then I switched branches, so the file no longer existed but the tab for it was still there in Atom. Once I closed the tab, the problem went away.

This should probably be handled more gracefully by Atom.


#4

There is a bug already open on this, if I recall correctly …


#5

I just got this too. one of the open tabs was an untitled document, the others existed. closed them all and all is fine once again.

    Failed to activate package named 'atom-supercollider' Error: Failed to execute 'createNodeIterator' on 'Document': The 1st argument provided is either null, or an invalid Node object.
  at Error (native)
  at [object Object].module.exports.React.createClass.measureCharactersInLine (/Applications/Atom.app/Contents/Resources/app/src/lines-component.js:436:35)
  at [object Object].boundMethod [as measureCharactersInLine] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at /Applications/Atom.app/Contents/Resources/app/src/lines-component.js:410:21
  at DisplayBuffer.module.exports.DisplayBuffer.batchCharacterMeasurement (/Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:436:7)
  at Editor.module.exports.Editor.batchCharacterMeasurement (/Applications/Atom.app/Contents/Resources/app/src/editor.js:2112:33)
  at [object Object].module.exports.React.createClass.measureCharactersInNewLines (/Applications/Atom.app/Contents/Resources/app/src/lines-component.js:402:21)
  at [object Object].boundMethod [as measureCharactersInNewLines] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at [object Object].module.exports.React.createClass.remeasureCharacterWidths (/Applications/Atom.app/Contents/Resources/app/src/lines-component.js:395:19)
  at [object Object].boundMethod [as remeasureCharacterWidths] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at [object Object].module.exports.React.createClass.remeasureCharacterWidths (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:1444:32)
  at [object Object].boundMethod [as remeasureCharacterWidths] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at [object Object].module.exports.React.createClass.onStylesheetsChanged (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:1232:19)
  at boundMethod (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
  at ThemeManager.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/emissary/lib/emitter.js:118:15)
  at ThemeManager.module.exports.ThemeManager.applyStylesheet (/Applications/Atom.app/Contents/Resources/app/src/theme-manager.js:341:12)
  at Package.module.exports.Package.activateStylesheets (/Applications/Atom.app/Contents/Resources/app/src/package.js:197:21)
  at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app/src/package.js:161:14)
  at Package.module.exports.Package.handleActivationEvent (/Applications/Atom.app/Contents/Resources/app/src/package.js:551:12)
  at HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/package.js:3:61)
  at HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
  at HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:400:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:181:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:142:20)