[SOLVED - Workaround]Cannot Add Local Game to Lutris - Data Length Less than Expected Header

This seems very related to Github bug 5496.
I am using the latest Lutris 0.5.17
Arch Linux, AMD 5800X, 7900XTX, 32GB RAM

This is a locally installed game, pointing to an .exe file. This same exact game worked on a previous version of Lutris, but it’s been awhile and I don’t remember when/what version. A suggested workraround I found online is to manually edit the .yml file, but I can’t even get that far as Lutris will not create the .yml file once the error is hit.

'Data length less than expected header length.'

Traceback (most recent call last):

  File "/usr/lib/python3.12/site-packages/lutris/exception_backstops.py", line 108, in error_wrapper
    return handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.12/site-packages/lutris/gui/config/game_common.py", line 688, in on_save
    self.game.runner.extract_icon(self.slug)

  File "/usr/lib/python3.12/site-packages/lutris/runners/wine.py", line 1244, in extract_icon
    groups = extractor.get_group_icons()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.12/site-packages/lutris/util/wine/extract_icon.py", line 81, in get_group_icons
    grp_icon_dir.__unpack__(data)

  File "/usr/lib/python3.12/site-packages/pefile.py", line 1026, in __unpack__
    raise PEFormatError("Data length less than expected header length.")

pefile.PEFormatError: 'Data length less than expected header length.'

Any help or insight into how to get this added would be appreciated, please let me know what other info may be helpful.

Edit: Same issue as Cannot save path to .exe when installing a specific game but the recommended workaround here looks to be manually editing the .yml file, but I can’t get that far.

Hi,
Have you got the packaged verison?
There was a change in May to the Git version if the extract via pefile or PIL bails, it still creates an entry rather than throwing an error.

Only other thing to try would be to pip3 update pefile (in case of bug with the system package) or remove the system pefile package - Lutris falls back to using PIL if it can’t find pefile, which may work.

I was using the version in the Arch “Extra” repositories, marked 0.5.17-7
I just uninstalled this and instead installed the lutris-git version from the AUR, 0.5.17.R385, looks like it was last updated on the 18th of this month. The same behavior persists however.

Python-pefile is installed through OS repos and is a dependency for Bottles. Should I try manually building/installing Lutris rather than pulling it from the AUR?

Well if pefile can’t handle your icon extract, and Lutris has no error handling for it (even though the GitHub ticket inferred it now does)

The easiest? option
Use another exe in the prefix to do the setup - say notepad.exe under drive_c/windows - or copy another basic .exe that the icon extract works on, then point the initial creation process at that.
That will at least give you YML you can edit.

If you’re definitely working off Gittris Lutris from GitHub (any still-running python Lutris processes or games actually stop you switching if you install both) then it would be worth bumping the original issue - slightly different case, but yours should still be handled by the same error handling.

Other options are more complicated, like trying an updated python3+pefile for your user, with no guarantees it works.

FYI I don’t get a problem on Mint 22, but my pefile package is pretty ancient (2023.2.7-3)

1 Like

Thank you very much, that was an effective workaround just creating a launcher for a different .exe and then editing the .yml

I’m able to launch the game now, great!