KSP-CKAN / CKAN

The Comprehensive Kerbal Archive Network
https://forum.kerbalspaceprogram.com/index.php?/topic/197082-*
Other
1.96k stars 349 forks source link

[Bug] Null reference in LatestAvailable via _UpdateModsList #2914

Closed aggie88 closed 4 years ago

aggie88 commented 4 years ago

Background

Have you made any manual changes to your GameData folder (i.e., not via CKAN)? no

Problem

When loading get the message unhandled exception has occurred in your application

Steps to reproduce

CKAN error code (if applicable):

System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at CKAN.Registry.LatestAvailable(String module, KspVersionCriteria ksp_version, RelationshipDescriptor relationship_descriptor)
   at CKAN.Registry.LatestAvailableWithProvides(String module, KspVersionCriteria ksp_version, IEnumerable`1 available_for_current_version, RelationshipDescriptor relationship_descriptor)
   at CKAN.Registry.allDependenciesCompatible(CkanModule mod, KspVersionCriteria ksp_version, CkanModule[] modules_for_current_version)
   at CKAN.Registry.Available(KspVersionCriteria ksp_version)
   at CKAN.Main._UpdateModsList(Boolean repo_updated, List`1 mc)
   at CKAN.Main.PostInstallMods(Object sender, RunWorkerCompletedEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e) 
HebaruSan commented 4 years ago

Which mods did you install before this?

aggie88 commented 4 years ago

Ksp-avc Restock Restock+

aggie88 commented 4 years ago

All updated via ckan last night

jamespglaze commented 4 years ago

EDIT: Operating system: Windows 10 Home CKAN Version: 1.24.0, updated to 1.26.4 and still seeing error KSP Version: 1.8.1.2694

I am seeing the same exception, I have converted to .txt and attached the .ckan files from today when I saw the error, and Nov 3rd when I I last launched and updated:

Stack trace:

System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at CKAN.Registry.LatestAvailable(String module, KspVersionCriteria ksp_version, RelationshipDescriptor relationship_descriptor)
   at CKAN.Registry.LatestAvailableWithProvides(String module, KspVersionCriteria ksp_version, IEnumerable`1 available_for_current_version, RelationshipDescriptor relationship_descriptor)
   at CKAN.Registry.allDependenciesCompatible(CkanModule mod, KspVersionCriteria ksp_version, CkanModule[] modules_for_current_version)
   at CKAN.Registry.Available(KspVersionCriteria ksp_version)
   at CKAN.Main._UpdateModsList(Boolean repo_updated, List`1 mc)
   at CKAN.Main.CurrentInstanceUpdated()
   at CKAN.Main.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Mod List:

        "name": "GravityTurnContinued",
        "version": "2:1.7.7"

        "name": "DistantObject",
        "version": "v1.9.1.1"

        "name": "KSP-AVC",
        "version": "1.4.0.2"

        "name": "EnvironmentalVisualEnhancements",
        "version": "2:EVE-1.8.0-2"

        "name": "KerbalXMod",
        "version": "1.1.0"

        "name": "RCSBuildAidCont",
        "version": "1:0.10.0"

        "name": "SmokeScreen",
        "version": "2.8.7.0"

        "name": "ClickThroughBlocker",
        "version": "0.1.9.3"

        "name": "KXAPI",
        "version": "1.2.0"

        "name": "FullAutoStrut",
        "version": "v3.0.1.0"

        "name": "TransferWindowPlanner",
        "version": "v1.7.2.0"

        "name": "WindTunnel",
        "version": "1.2.3"

        "name": "Trajectories",
        "version": "v2.2.3"

        "name": "HeapPadder",
        "version": "0.0.1.5"

        "name": "PreciseNode",
        "version": "1.2.11"

        "name": "DistantObject-default",
        "version": "v1.9.1.1"

        "name": "KerbalEngineerRedux",
        "version": "1.1.7.1"

        "name": "KramaxAutopilotContinued",
        "version": "0.4.0"

        "name": "ModuleManager",
        "version": "4.1.1"

        "name": "Toolbar",
        "version": "1:1.8.0.5"

        "name": "KerboKatzUtilities",
        "version": "1.5.2-KSP1.8"

        "name": "AutomatedScienceSampler",
        "version": "1.3.5-KSP1.8"

        "name": "xScienceContinued",
        "version": "5.23"

        "name": "CorrectCoL",
        "version": "1.6.5.3"

        "name": "DockRotate",
        "version": "v1.8.1.41"

        "name": "ToolbarController",
        "version": "1:0.1.9.4"

        "name": "AstronomersVisualPack",
        "version": "2:3.8.3.0"

        "name": "AVP-8kTextures",
        "version": "v1.9"

        "name": "RealPlume",
        "version": "2:v13.0.1"

        "name": "CameraTools",
        "version": "v1.13.0"

        "name": "Scatterer",
        "version": "2:v0.0541"

        "name": "RealPlume-StockConfigs",
        "version": "v2.0.1"

        "name": "Scatterer-config",
        "version": "2:v0.0541"

        "name": "ModularFlightIntegrator",
        "version": "1.2.7.0"

        "name": "Scatterer-sunflare",
        "version": "2:v0.0541"

        "name": "Milkyway-Skybox-SpaceEngine",
        "version": "1.0"

        "name": "TextureReplacer",
        "version": "v3.7"

Mods updated since last successful launch:

        "name": "PreciseNode",
        "version": "1.2.10.3" -> "1.2.11"

        "name": "KramaxAutopilotContinued",
        "version": "0.3.7" -> "0.4.0"

        "name": "DockRotate",
        "version": "v1.8.1.40" -> "v1.8.1.41"

.ckan files:

installed-auto-2019-11-06_22-18-35.ckan.txt installed-auto-2019-11-03_12-56-11.ckan.txt

repro steps:

Can't access mod list in ckan so can't test, but I would assume install my mod list and then restart and attempt to update repository.

HebaruSan commented 4 years ago

CKAN version?

HebaruSan commented 4 years ago

I think this is related to KerbalAtomics using any_of with spec_version of v1.4. It should be v1.26 to filter that version out on CKAN clients that don't support any_of. Need to update the netkan validators, this snuck past them because this module uses a metanetkan.

https://github.com/KSP-CKAN/CKAN-meta/commit/967423fbfe09bdd1d8af4a42ea46fa716b2d92bb

aggie88 commented 4 years ago

Cannot see ckan versión as it crashes with the error version # comes blank

HebaruSan commented 4 years ago

@aggie88, please try this:

  1. Open a command prompt
  2. Change directory to where you saved your ckan.exe file
  3. Run ckan.exe version
  4. Copy the output
  5. Paste it into a reply here
HebaruSan commented 4 years ago

@jamespglaze

CKAN Version: 1.24.0, updated to 1.26.4 and still seeing error

I think that is because 1.24.0 corrupted your registry (since it does not know about any_of, it loaded that relationship as empty, and 1.26.4 can't handle an empty relationship either). It should be possible to repair it, but it would require manual editing of JSON data. I am willing to do this for you if you like:

  1. Open your KSP folder
  2. Open the CKAN folder
  3. Find the registry.json file, zip it, and attach it to a reply here
jamespglaze commented 4 years ago

@HebaruSan I'll take a stab at manually repairing it when I get home from work cause I enjoy reverse engineering. Worst comes to worst I can just do a clean install. I've got the full list of mods so it wouldn't take long at all.

HebaruSan commented 4 years ago

You might be able to repair this now by running ckan.exe update from the command line, since the upstream metadata problem has been fixed.

jamespglaze commented 4 years ago

@HebaruSan thanks! updating from the command line cleared the corruption. Back in business now.

aggie88 commented 4 years ago

Ckan version 1.24.0+195ed164d95f

HebaruSan commented 4 years ago

@aggie88 Yeah, upgrade to the latest and run ckan.exe upgrade like jamespglaze did, that is a very old version by now:

https://github.com/KSP-CKAN/CKAN/releases/latest

HebaruSan commented 4 years ago

The metadata is fixed, better validation is in place, we have recovery steps for users, and the affected version is from Feb 2018. I'm calling this resolved.