Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings could not be loaded from file. Element not found (when running unpackaged) #12305

Closed
Eddie-Shipman opened this issue Jan 31, 2022 · 26 comments · Fixed by #12687
Closed
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@Eddie-Shipman
Copy link

Eddie-Shipman commented Jan 31, 2022

Windows Terminal version

Preview 1.11.2421

Windows build number

10.0.18363

Other Software

No response

Steps to reproduce

Install the Preview version from this link then open. Can't open the settings file and can't save settings after change

Expected Behavior

Was expecting to load and be able to open and set the default profile

Actual Behavior

Got the following dialog:
TerminalIssue

I see no settings.json file in the installation and the one named defaults.json doesn't change. Also, there was no directory created here: %LOCALAPPDATA%\Packages\Microsoft. WindowsTerminal_8wekyb3d8bbwe\LocalState\

I found it here: %USERPROFILE%\AppData\Local\Microsoft\Windows Terminal
But after checking for well-formed JSON, it looks correct. Just can't understand why it won't open.

Not sure if it matters but I did NOT run through and actual installation, I renamed the files, msixbundle/msix, as zip and extracted them

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jan 31, 2022
@zadjii-msft
Copy link
Member

Can you share the actual json file, and maybe also the contents of state.json, if there is one next to settings.json?

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 31, 2022
@Eddie-Shipman
Copy link
Author

Eddie-Shipman commented Feb 1, 2022

// This file was initially generated by Windows Terminal 0.11.1333.0    
// It should still be usable in newer versions, but newer versions might have additional    
// settings, help text, or changes that you will not see unless you clear this file    
// and let us generate a new one for you.    
    
// To view the default settings, hold "alt" while clicking on the "Settings" button.    
// For documentation on these settings, see: https://aka.ms/terminal-documentation    
{    
    "$schema": "https://aka.ms/terminal-profiles-schema",    
    
    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",    

    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings

    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,

    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
        },
      "list": [
        {
          // Make changes here to the powershell.exe profile.
          "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
          "name": "Windows PowerShell",
          "commandline": "powershell.exe",
          "hidden": false
        },
        {
          // Make changes here to the cmd.exe profile.
          "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
          "name": "Command Prompt",
          "commandline": "cmd.exe",
          "hidden": false
        }
      ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [],

    // Add custom keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about keybindings, visit https://aka.ms/terminal-keybindings
    "keybindings":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        // Press Ctrl+Shift+F to open the search box
        { "command": "find", "keys": "ctrl+shift+f" },

        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]
}

There is no state.json file. I found the location of settings.json is actually in
%USERPROFILE%\AppData\Local\Microsoft\Windows Terminal
instead of in
%USERPROFILE%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState

Even if I copy the file to both locations, I still get the error dialog.

I tried unzipping to a new installation folder after deleting the above directories. It did not create the LocalState folder upon running or editing the settings; it crated the other folder but there is no settings.json file there. I clicked the Open JSON file button, it opened Visual Studio with no file open. Making changes to the settings results in the same error when attempting to save.

The error dialog says "Element not found" What element is it looking for, do you think?

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Feb 1, 2022
@JSamir
Copy link

JSamir commented Feb 9, 2022

I've got the same issue after updating windows terminal via scoop to the latest stable version. Uninstalling/reinstalling did not help. The json files were valid too.

I have uninstalled the latest version and reinstalled 1.11.3471.0 and everything works again.

One thing I noticed is that after windows terminal loads the default settings since it cannot read the settings.json apparently, in the default config there is no wsl. If I remember correctly, wsl is detected automatically also in the default config right? So maybe the latest version has a problem that is somehow related to wsl? I did remove the wsl part of my config but that did not help though. Also it did not help to remove all the files from \AppData\Local\Microsoft\Windows Terminal.

@Eddie-Shipman
Copy link
Author

@JSamir Thanks for that, I downloaded that version and it worked for me. I'm just curious as to what is causing the error

@zadjii-msft Mike, any ideas on why it happened?

@zadjii-msft
Copy link
Member

Honestly, no idea. %USERPROFILE%\AppData\Local\Microsoft\Windows Terminal is a perfectly fine place for the settings to be if you're running unpackaged (which is what happens when the Terminal is installed from scoop).

Only theory is that we somehow failed to create the settings file entirely, but that should give a more descriptive error... Actually I think it's supposed to: #7950

@rdbisme
Copy link

rdbisme commented Feb 17, 2022

Same problem here. After update from scoop, settings.json can't be loaded anymore. I tried to remove the %USERPROFILE%\AppData\Local\Microsoft\Windows Terminal completely. At next startup the folder is created again and I get the error nonetheless.

Terminal (Unpackaged)
Version: 1.12.220208003-release1.12

@zadjii-msft
Copy link
Member

Since we've got a number of reports of this happening for unpackaged installs, I'm gonna bump this one into 1.14, so we make sure someone takes a look sooner than later. I wonder if this has anything to do with state.json loading? I honestly have no idea.

@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Feb 22, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Feb 22, 2022
@zadjii-msft zadjii-msft added this to the Terminal v1.14 milestone Feb 22, 2022
@zadjii-msft zadjii-msft changed the title New installation, Settings could not be loaded from file. Element not found. Settings could not be loaded from file. Element not found (when running unpackaged) Feb 22, 2022
@rdbisme
Copy link

rdbisme commented Feb 22, 2022

Well, the state.json is created in that same folder. But I removed it so...

@Rosefield
Copy link
Contributor

Rosefield commented Feb 22, 2022

I had this happen to me as well when my instance of WT preview updated from 1.12.x to 1.13 through the store so it isn't just unpackaged installs,.

I misremembered and had a different error than this / cannot reproduce.

@lhecker
Copy link
Member

lhecker commented Mar 10, 2022

I can't replicate this issue personally with neither 1.12 nor 1.13. I also tried using the settings.json posted at the beginning of this issue.

Can someone who has this issue try and download the latest release on GitHub, extract it and run it? Basically:

  • Download a release
  • Extract the .msixbundle (it's just a zip)
  • Extract the .msix file matching your platform (it's also a zip)
  • Run WindowsTerminal.exe

I just want to make sure whether running our "official release" unpackaged would produce the same issue, since I personally can't...

@Saberos
Copy link

Saberos commented Mar 11, 2022

I can't replicate this issue personally with neither 1.12 nor 1.13. I also tried using the settings.json posted at the beginning of this issue.

Can someone who has this issue try and download the latest release on GitHub, extract it and run it? Basically:

* [Download a release](https://github.com/microsoft/terminal/releases/tag/v1.12.10393.0)

* Extract the .msixbundle (it's just a zip)

* Extract the .msix file matching your platform (it's also a zip)

* Run WindowsTerminal.exe

I just want to make sure whether running our "official release" unpackaged would produce the same issue, since I personally can't...

Can confirm I can reproduce the issue with above steps using versions v1.12.10393.0 and v1.13.10395.0.

@audetto
Copy link

audetto commented Mar 11, 2022

Can someone who has this issue try and download the latest release on GitHub, extract it and run it? Basically:

* [Download a release](https://github.com/microsoft/terminal/releases/tag/v1.12.10393.0)

* Extract the .msixbundle (it's just a zip)

* Extract the .msix file matching your platform (it's also a zip)

* Run WindowsTerminal.exe

This is exactly what I reported the very first time with 1.12.10393.0 (see #12547)

@lhecker
Copy link
Member

lhecker commented Mar 11, 2022

Ah dang, I only read the most recent comments in this issue. I'm sorry about that. 😕
I'll try to replicate the issue on Windows 10, but I suspect I won't succeed with that either.
Since only someone who's able to reproduce the issue can fix it, this bug is a bit troublesome unfortunately...

@Eddie-Shipman
Copy link
Author

This happened in Preview 1.11.2421
Initially, I did NOT run through an actual installation, I renamed the files, msixbundle/msix, as zip and extracted them.

The error dialog says "Element not found" What element is it looking for, do you think?

@lhecker
Copy link
Member

lhecker commented Mar 11, 2022

The error dialog says "Element not found" What element is it looking for, do you think?

It's probably a ERROR_NOT_FOUND or TYPE_E_ELEMENTNOTFOUND. You could try to run DebugView and see if anything obvious comes up when you start Windows Terminal. There's a good chance that the source of this error is written in there.

@audetto
Copy link

audetto commented Mar 11, 2022

I tried to build it from source, but it has proven very hard.
Would it not be possible to provide a "debug/logging" version which tells a bit more which file and which element is looking for?

@Eddie-Shipman
Copy link
Author

I downloaded 1.11.3471.0 and the error didn't occur, so it has to be some change that happened between those versions.

@DHowett
Copy link
Member

DHowett commented Mar 11, 2022

Do you happen to have any files in...

C:\ProgramData\Microsoft\Windows Terminal\Fragments
%LOCALAPPDATA%\Microsoft\Windows Terminal\Fragments

?

If not, can you run the following PowerShell command? It might produce a lot of output...

Get-AppxPackage | ? {
    If (-Not [String]::IsNullOrEmpty($_.InstallLocation)) {
        $am = [xml](Get-Content (Join-Path $_.InstallLocation "AppxManifest.xml"))
        $am.InnerXml.Contains("terminal.settings")
        Return
    }
    $False
} | Select -Expand PackageFullName

@Eddie-Shipman
Copy link
Author

I was able to downgrade to version 1.11.3471.0 and everything worked as desired.

@DHowett
Copy link
Member

DHowett commented Mar 11, 2022

In addition to the request above, would you mind collecting a trace for us? I'd love to get this issue kicked once and for all. Here is how to capture a trace.

@audetto
Copy link

audetto commented Mar 13, 2022

Running 1.12.10393.0 in VS2019

image

any useful?

@audetto
Copy link

audetto commented Mar 13, 2022

I have a trace but it is inside the corporate network... I will have to ask how to bring it out. Anything I could do with it?

Maybe make it readable and take a screenshot?

@lhecker
Copy link
Member

lhecker commented Mar 13, 2022

@audetto If you copy and paste the text with ```<text here>``` on GitHub it's easier to read. 🙂

Yes, it's very helpful! Thanks to your screenshot I immediately found the source of the issues and will submit a PR soon.
Thank you again for your help figuring this out. 😊

@ghost ghost added the In-PR This issue has a related PR label Mar 14, 2022
@audetto
Copy link

audetto commented Mar 14, 2022

Sorry, I can't, it is all running in a remote app where I cannot copy from...

@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Mar 14, 2022
DHowett pushed a commit that referenced this issue Mar 14, 2022
This commit fixes a stray exception during settings loading,
caused by a failure to obtain the app's extension catalog.

## PR Checklist
* [x] Closes #12305
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed
I'm unable to replicate the issue. ❌
However an error log was provided in #12305 with which
the function causing the exception could be determined.
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Mar 14, 2022
DHowett pushed a commit that referenced this issue Mar 14, 2022
This commit fixes a stray exception during settings loading,
caused by a failure to obtain the app's extension catalog.

## PR Checklist
* [x] Closes #12305
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed
I'm unable to replicate the issue. ❌
However an error log was provided in #12305 with which
the function causing the exception could be determined.

(cherry picked from commit 9c6ec75)
DHowett pushed a commit that referenced this issue Mar 14, 2022
This commit fixes a stray exception during settings loading,
caused by a failure to obtain the app's extension catalog.

## PR Checklist
* [x] Closes #12305
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed
I'm unable to replicate the issue. ❌
However an error log was provided in #12305 with which
the function causing the exception could be determined.

(cherry picked from commit 9c6ec75)
@ghost
Copy link

ghost commented Mar 25, 2022

🎉This issue was addressed in #12687, which has now been successfully released as Windows Terminal v1.12.1073.:tada:

Handy links:

@ghost
Copy link

ghost commented Mar 25, 2022

🎉This issue was addressed in #12687, which has now been successfully released as Windows Terminal Preview v1.13.1073.:tada:

Handy links:

hmalphettes added a commit to hmalphettes/Extras that referenced this issue Apr 1, 2022
This release fixes the issue "Element not found" affecting a number of scoop users:
microsoft/terminal#12305
issaclin32 pushed a commit to ScoopInstaller/Extras that referenced this issue Apr 1, 2022
* Update Windows Terminal to v1.12.10732

This release fixes the issue "Element not found" affecting a number of scoop users:
microsoft/terminal#12305

* Windows-terminal: fix the autoupdate

The autoupdate URL scheme has changed.
Note that the release notes specify that the Win10 flavor of the URL will work just as well for Win11:

> If you install the Windows 10 verison on Windows 11, it will probably automatically upgrade itself to the Windows 11
version. It turns out that it is impossible to have two bundles with the same version number, so it has to be this
way.

https://github.com/microsoft/terminal/releases/tag/v1.12.10732.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants