How do I fix "Unable to find a valid document up in the document tree" without access to the backend?

This is related to Changing type of Homepage-node causes Footer to throw an exception .

My problem: The ‘homepage’ of my dual-language site doesn’t load at all, although sub-pages do.

I created a custom node SmallTopNav using this code:

NodeTypes.yaml:

...
'TYPO3.Neos.NodeTypes:SmallTopNav':
  superTypes:
    'TYPO3.Neos.NodeTypes:Page': TRUE
  ui:
    label: 'SmallTopNav'
  childNodes:
    'footer':
      position: 'end'
      type: 'TYPO3.Neos:ContentCollection'
      constraints:
        nodeTypes:
          '*': FALSE
          'TYPO3.Neos.NodeTypes:Headline': TRUE
          'TYPO3.Neos.NodeTypes:Text': TRUE
          'TYPO3.Neos.NodeTypes:Image': TRUE
  properties:
    'layout':
      ui:
        inspector:
          group: 'layout'
          editorOptions:
            values:
              'default': 
              'landingPage':                 
              'smallTopNav':
                label: 'SmallTopNav Default'
              'smallTopNavTheme1':
                label: 'SmallTopNav Theme 1'
              'smallTopNavTheme2':
                label: 'SmallTopNav Theme 2'
    'subpageLayout':
      ui:
        inspector:
          group: 'layout'
          editorOptions:
            values:
              'default': 
              'landingPage':                 
              'smallTopNav':
                label: 'SmallTopNav Default'
              'smallTopNavTheme1':
                label: 'SmallTopNav Theme 1'
              'smallTopNavTheme2':
                label: 'SmallTopNav Theme 2'
    'image':
      type: 'TYPO3\Media\Domain\Model\ImageInterface'
      ui:
        label: 'TYPO3.NeosDemoTypo3Org:NodeTypes.Page:properties.image'
        reloadIfChanged: TRUE
        inspector:
          group: 'image'
          position: 50
          editorOptions:
            crop:
              aspectRatio:
                locked:
                  width: 4
                  height: 1

Root.ts2

...
smallTopNav < page
smallTopNav {
        head {
                stylesheets {
                        site = TYPO3.TypoScript:Template {
                                themecss = ""
                                templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/SmallTopNav.html'
                                sectionName = 'stylesheets'
                                node = ${node}
                        }
                }
        }
        body {
                templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/SmallTopNav.html'
                smallTopNav = ${true}
		parts {
			smallTopNavMainMenu = Menu {
				entryLevel = 1
				maximumLevels = 2
				templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/TypoScriptObjects/SmallTopNavMainMenu.html'
			}
                }
                javascripts.site = TYPO3.TypoScript:Template {
                        templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/SmallTopNav.html'
                        sectionName = 'bodyScripts'
                }
        }
}
smallTopNavTheme1 < smallTopNav
smallTopNavTheme1 {
    head.stylesheets.site = TYPO3.TypoScript:Template {
                themecss = "Styles/smalltopnavtheme1.css"
    }
}
smallTopNavTheme2 < smallTopNav
smallTopNavTheme2 {
    head.stylesheets.site = TYPO3.TypoScript:Template {
                themecss = "Styles/smalltopnavtheme2.css"
    }
}

I then changed the type of the root node from “Homepage” to “SmallTopNav” and everything seemed to work fine.
I subsequently filled the root page with content by copying content-collection nodes from one page to this one.
At first this seemed just fine, but at one point the backend became unresponsive.
Ever since then, the homepage of that site became unreachable, both in the back- and frontend.

Node-repair didn’t help - it either says everything is fine or that it “Could not find “/sites” root node”, depending on whether english or german is set as a default language.

Right now I can’t access the german version of the site-root-node, although the default us_en version works.

Is there a way to change the root node type back to “Homepage” via shell commands?
Or maybe just replace the german root node with a copy of the workin english node?

I tried to recreate the error and I could:

In the backend, I selected a teaser image. After clicking crop, the page breaks.
Simply changing the teaser image has the same result.

This only happens with my SmallTopNav page type, though, and only if applied to the root page.

Sounds like broken content dimensions. They are a bit tricky to solve, but can be done in the database in the nodedata and nodedimension tables.

Alternatively you might be able to use some of the available node migrations, but not sure about that though.