Skip to content

IndexError: list index out of range #29

Description

@brianmay
[nix-shell:~/private/finances/ledger]$ bh format accounts.beancount
[10:03:57] INFO     Processing file accounts.beancount                             format.py:90
           INFO     Calculate column width                                     formatter.py:646
           INFO     Collecting                                                 formatter.py:130
Traceback (most recent call last):
  File "/nix/store/zjlv2snqfxnf74mrk8yaips6c12m2yqd-python3.12-beanhub-cli-1.4.1/bin/.bh-wrapped", line 9, in <module>
    sys.exit(cli())
             ^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/6k64nlqhg20cky326qhh6282z6zkpr5s-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zjlv2snqfxnf74mrk8yaips6c12m2yqd-python3.12-beanhub-cli-1.4.1/lib/python3.12/site-packages/beanhub_cli/format.py", line 93, in main
    formatter.format(tree, output_file)
  File "/nix/store/1l65k28d3za35dchmnvf15y93x0nn4dc-python3.12-beancount-black-1.0.5/lib/python3.12/site-packages/beancount_black/formatter.py", line 696, in format
    sections.append(self.format_statement_group(group))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1l65k28d3za35dchmnvf15y93x0nn4dc-python3.12-beancount-black-1.0.5/lib/python3.12/site-packages/beancount_black/formatter.py", line 573, in format_statement_group
    last_entry = entries[-1]
                 ~~~~~~~^^^^
IndexError: list index out of range

The file is valid:

$ bean-check accounts.beancount
[ no output and exit==0 ]

Unfortunately I am not sure which transaction is causing this problem.

Note: while I used beanhub-cli this bug actually looks like a problem with beancount-black,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions