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

KeyError: HullValue in monitor.py: parse_entry() #2317

Open
2 tasks done
foresto opened this issue Oct 21, 2024 · 5 comments
Open
2 tasks done

KeyError: HullValue in monitor.py: parse_entry() #2317

foresto opened this issue Oct 21, 2024 · 5 comments
Labels
bug unconfirmed An unconfirmed bug

Comments

@foresto
Copy link
Contributor

foresto commented Oct 21, 2024

Please complete the following information:

  • Version: 5.12.1+fc00839d
  • Game Version: Horizons Live
  • OS: Linux (flatpak freedesktop runtime 23.08)
  • OS Locale: English

Describe the bug

A stack trace appears in the debug log, along with this message:

Traceback (most recent call last):
  File "/home/alt/edmarketconnector/EDMarketConnector-5.12.1/monitor.py", line 713, in parse_entry
    'HullValue': entry['HullValue'],
                ~~~~~^^^^^^^^^^^^^
KeyError: 'HullValue'

To Reproduce

I'm not sure what triggered the log entry that EDMarketConnector is complaining about, but I was switching ships at the time, and the entry in question is about one of my ships.

Expected behavior

No error message, no stack trace.

Additional context

Please Confirm the Following...

Logs

Relevant part of EDMarketConnector-debug.log

2024-10-21 04:56:30.173 UTC - DEBUG - 986:140371831596992:986 monitor.EDLogs.parse_entry:1836: Invalid journal entry:
b'{ "timestamp":"2024-10-21T04:56:29Z", "event":"Loadout", "Ship":"sidewinder", "ShipID":0, "ShipName":"MYSHIPNAME", "ShipIdent":"SHIP-1", "ModulesValue":7240, "HullHealth":1.000000, "UnladenMass":39.900002, "CargoCapacity":4, "MaxJumpRange":10.327957, "FuelCapacity":{ "Main":2.000000, "Reserve":0.300000 }, "Rebuy":362, "Modules":[ { "Slot":"SmallHardpoint1", "Item":"hpt_pulselaser_gimbal_small", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"SmallHardpoint2", "Item":"hpt_pulselaser_gimbal_small", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"Armour", "Item":"sidewinder_armour_grade1", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"PaintJob", "Item":"paintjob_sidewinder_pilotreward_01", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"PowerPlant", "Item":"int_powerplant_size2_class2", "On":true, "Priority":1, "Health":1.000000, "Value":5931 }, { "Slot":"MainEngines", "Item":"int_engine_size2_class1", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"FrameShiftDrive", "Item":"int_hyperdrive_size2_class2", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"LifeSupport", "Item":"int_lifesupport_size1_class1", "On":true, "Priority":0, "Health":1.000000 }, { "Slot":"PowerDistributor", "Item":"int_powerdistributor_size1_class1", "On":true, "Priority":3, "Health":1.000000 }, { "Slot":"Radar", "Item":"int_sensors_size1_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"FuelTank", "Item":"int_fueltank_size1_class3", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"Decal1", "Item":"decal_explorer_mostly_aimless", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"Slot01_Size2", "Item":"int_shieldgenerator_size2_class1", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"Slot03_Size1", "Item":"int_cargorack_size1_class1", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"Slot04_Size1", "Item":"int_cargorack_size1_class1", "On":true, "Priority":1, "Health":1.000000, "Value":1000 }, { "Slot":"Slot05_Size1", "Item":"int_fuelscoop_size1_class1", "On":true, "Priority":0, "Health":1.000000, "Value":309 }, { "Slot":"Slot06_Size1", "Item":"int_supercruiseassist", "On":true, "Priority":0, "Health":1.000000 }, { "Slot":"PlanetaryApproachSuite", "Item":"int_planetapproachsuite_advanced", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"VesselVoice", "Item":"voicepack_verity", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"ShipCockpit", "Item":"sidewinder_cockpit", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"CargoHatch", "Item":"modularcargobaydoor", "On":true, "Priority":2, "Health":1.000000 } ] }\r\n'
Traceback (most recent call last):
File "/path/to/EDMarketConnector-5.12.1/monitor.py", line 713, in parse_entry
'HullValue': entry['HullValue'],
~~~~~^^^^^^^^^^^^^
KeyError: 'HullValue'

@foresto foresto added bug unconfirmed An unconfirmed bug labels Oct 21, 2024
@dwomble
Copy link

dwomble commented Oct 29, 2024

I accidentally duplicated this issue here 2320. Thought I'd checked but apparently missed it.

@chennin
Copy link
Contributor

chennin commented Nov 13, 2024

I can reproduce the stack trace by swapping to one of my Imperial Eagles or two of Imperial Couriers. Not sure what the difference is, another of my Imperial Eagles does not have the problem. The log in #2295 also has the error on a "typex" which I assume is a Type 10.

I've actually had the error 8 times in my last 3 EDMC debug logs, but I never noticed any issue it caused. @dwomble reported on Discord that the BGS-Tally plugin broke afterwards.

EDMarketConnector-debug.log

@foresto
Copy link
Contributor Author

foresto commented Nov 13, 2024

I never noticed any issue it caused.

I suspect this bug is the reason why one of my ship's outfitted modules haven't made it into Inara. I haven't proven it, though.

@Athanasius
Copy link
Contributor

  1. Using entry.get('HullValue', 0) would work around this as a quick patch.
  2. Apparently the Journal Manual says this field might not always be present, so code is needed to work around it anyway.

Need to consider what placeholder value to have there. Keep the key with a 0 ? Not populate the key at all ? Consequences for downstream use of the value (both core EDMC, EDMC core plugins and third-party plugins/plugin documentation).

@chennin
Copy link
Contributor

chennin commented Nov 13, 2024

Additionally from logs in #2330, a different key error:

2024-11-13 00:28:27.236 UTC - DEBUG - 6196:25380:25380 monitor.EDLogs.parse_entry:1836: Invalid journal entry:^M
b'{ "timestamp":"2024-11-13T00:28:28Z", "event":"Loadout", "Ship":"diamondback", "ShipID":4, "ShipName":"", "ShipIdent":"MA-13D", "HullValue":564329, "HullHealth":1.000000, "UnladenMass":219.000000, "CargoCapacity":0, "MaxJumpRange":12.167933, "FuelCapacity":{ "Main":16.000000, "Reserve":0.490000 }, "Rebuy":28216, "Modules":[ { "Slot":"MediumHardpoint1", "Item":"hpt_pulselaser_fixed_small", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"MediumHardpoint2", "Item":"hpt_pulselaser_fixed_small", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"Armour", "Item":"diamondback_armour_grade1", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"PowerPlant", "Item":"int_powerplant_size4_class1", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"MainEngines", "Item":"int_engine_size4_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"FrameShiftDrive", "Item":"int_hyperdrive_size4_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"LifeSupport", "Item":"int_lifesupport_size2_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"PowerDistributor", "Item":"int_powerdistributor_size3_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"Radar", "Item":"int_sensors_size2_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"FuelTank", "Item":"int_fueltank_size4_class3", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"Slot01_Size3", "Item":"int_shieldgenerator_size3_class1", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"Slot05_Size1", "Item":"int_supercruiseassist", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"Slot06_Size1", "Item":"int_dockingcomputer_advanced", "On":true, "Priority":2, "Health":1.000000 }, { "Slot":"PlanetaryApproachSuite", "Item":"int_planetapproachsuite_advanced", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"VesselVoice", "Item":"voicepack_verity", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"ShipCockpit", "Item":"diamondback_cockpit", "On":true, "Priority":1, "Health":1.000000 }, { "Slot":"CargoHatch", "Item":"modularcargobaydoor", "On":true, "Priority":2, "Health":1.000000 } ] }\r\n'^M
Traceback (most recent call last):^M
  File "monitor.pyc", line 714, in parse_entry^M
KeyError: 'ModulesValue'^M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unconfirmed An unconfirmed bug
Projects
None yet
Development

No branches or pull requests

4 participants