Intermittent undefined hook removal assertion during cleanup

Open
#4,396 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@baphomello is already working on this.

Since Nov 21, 2026.

  • #4399 by @baphomello — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
perl
Domain
testing

Research direction

Start by reading src/Utils/ObjectList.pm (remove/clear) to see where the assertion is raised, then src/Plugins.pm (delHook) and src/InventoryList.pm (DESTROY) for the call chain. Try to reproduce with make test and, since it is intermittent, consider running the suite repeatedly or with a random test order. Note that pull request #4399 is already open against this issue, so coordinate there before writing code; done means the undefined handle is traced and the test command exits nonzero on a cleanup assertion.

Written by the indexing model from the issue text.

Description

bug
Openkore version git

OpenKore git development tree; exact commit at the time of the warning was not recorded

XKore Mode

Empty

RO Server Name

N/A — unit tests; no Ragnarok server was involved

Link to RO server

N/A — unit tests; no server link applies

Result

During one execution of OpenKore's unit test suite, the TAP plan completed with all 1,923 tests passing, then Perl emitted:

(in cleanup) Assertion (Can't remove undefined item) failed!

The test runner returned exit code 0 despite the cleanup assertion. The warning appeared once and did not recur in four subsequent runs on either the development branch or its unchanged base. There is no confirmed reproduction sequence or root cause.

This was noticed while validating unrelated XSTools compatibility work. The cleanup code described below was unchanged by that work. No gameplay impact has been confirmed.

Potentially relevant current code:

  • src/InventoryList.pm, InventoryList::DESTROY, invokes Plugins::delHook for stored hook handles before clearing the list.
  • src/Plugins.pm, Plugins::delHook, gets an entry by saved hook index and passes it to remove without a defined check.
  • src/Utils/ObjectList.pm, ObjectList::remove, asserts that the item is defined using the observed assertion text.

This code relationship is worth investigating, but it does not establish that this path caused the observed warning. Possible explanations include stale hook handles, duplicate removal, an invalidated index, or object destruction order.

Related history:

This report does not attribute the warning to macOS, Apple Silicon, a particular Perl version, or XSTools.

Relevant Log Output
(in cleanup) Assertion (Can't remove undefined item) failed!
Expected Result

Ideally, test cleanup should complete without this assertion. If a cleanup assertion does occur, the test command should report failure with a nonzero exit status so automation does not silently pass.

How to Reproduce

The issue is intermittent and no deterministic reproduction is known. In one make test execution, all 1,923 TAP tests passed, then the cleanup assertion appeared and the command returned exit code 0. It did not recur in four subsequent runs on either the development branch or its unchanged base.

Dominant language
Perl
Stars
1.5k
Forks
1.2k
Avg merge
11h
Merged PRs (30d)
110

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenKore/openkore

All issues in OpenKore/openkore

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.