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

[BUG] Index out of range crash when trying to call a non-existent function #123

Open
soko7awen opened this issue Jan 11, 2025 · 0 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@soko7awen
Copy link

Describe the bug

In my case, I had forgot to update the function's name when I called it later on in the script. Then, I got this crash.

Here is the log:

Unexpected error causes program to crash
IndexError
list index out of range
Traceback (most recent call last):
  File "/home/soko/.local/lib/python3.13/site-packages/jmc/terminal_commands.py", line 62, in compile_
    compile_jmc(global_data.config, debug=True)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/soko/.local/lib/python3.13/site-packages/jmc/compile/compiling.py", line 41, in compile_jmc
    build(lexer.datapack, config, is_delete, cert_config, cert_file)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/soko/.local/lib/python3.13/site-packages/jmc/compile/compiling.py", line 282, in build
    datapack.build()
    ~~~~~~~~~~~~~~^^
  File "/home/soko/.local/lib/python3.13/site-packages/jmc/compile/datapack.py", line 540, in build
    raise JMCValueError(
          ~~~~~~~~~~~~~^
        f"Function '{function_called}' was not defined", token, tokenizer)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/soko/.local/lib/python3.13/site-packages/jmc/compile/exception.py", line 183, in __init__
    msg = error_msg(message, token, tokenizer, col_length,
                    display_col_length, entire_line, suggestion)
  File "/home/soko/.local/lib/python3.13/site-packages/jmc/compile/exception.py", line 86, in error_msg
    line_ = overide_file_str(msgs_[display_line - 1])
                             ~~~~~^^^^^^^^^^^^^^^^^^
IndexError: list index out of range

Please report this error at https://github.com/WingedSeal/jmc/issues/new/choose or https://discord.gg/PNWKpwdzD3.

The code in question (please don't ridicule my awesome coding skills haha):

function place.marker_death_lobby() {
    gamerule spawnRadius 0;
    execute positioned 0 320 0 expand {
        execute unless block ~ ~-1 ~ minecraft:barrier run { setblock ~ ~-1 ~ barrier; }
        execute at @e[tag=marker_death_lobby] run { forceload remove ~ ~; }
        forceload add ~-2 ~-2 ~2 ~2;
        kill @e[tag=marker_death_lobby];
        execute align xyz run {
            summon minecraft:armor_stand ~.5 ~ ~.5 {Team:"debug",Tags:["marker_death_lobby"],Marker:1b,Invisible:1b};
            setworldspawn ~ ~ ~;
        }
    }
}
place.death_lobby();

Desktop

  • Fedora 41, installed through package manager's pip.
@soko7awen soko7awen added the Type: Bug Something isn't working label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants