[GH-ISSUE #56] System.IndexOutOfRangeException #52

Closed
opened 2026-02-26 17:44:10 +03:00 by kerem · 9 comments
Owner

Originally created by @DerDanilo on GitHub (Dec 6, 2021).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-autosnap/issues/56

Last working version: v1.11.0
PVE Version: 6.4.x

================ EXCEPTION ================
System.IndexOutOfRangeException
Index was outside the bounds of the array.
   at BetterConsoleTables.Table.ToString(Int32[] columnLengths)
   at BetterConsoleTables.Table.ToString()
   at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows)
   at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows)
   at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercenta
geStorage)
   at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)

Thanks for checking!

Originally created by @DerDanilo on GitHub (Dec 6, 2021). Original GitHub issue: https://github.com/Corsinvest/cv4pve-autosnap/issues/56 Last working version: v1.11.0 PVE Version: 6.4.x ``` ================ EXCEPTION ================ System.IndexOutOfRangeException Index was outside the bounds of the array. at BetterConsoleTables.Table.ToString(Int32[] columnLengths) at BetterConsoleTables.Table.ToString() at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercenta geStorage) at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args) ``` Thanks for checking!
kerem 2026-02-26 17:44:10 +03:00
Author
Owner

@franklupo commented on GitHub (Dec 6, 2021):

Hi,
execute with parameter --debug and attach output.

Bets regards

<!-- gh-comment-id:986529352 --> @franklupo commented on GitHub (Dec 6, 2021): Hi, execute with parameter --debug and attach output. Bets regards
Author
Owner

@DerDanilo commented on GitHub (Dec 6, 2021):

execute with parameter --debug and attach output.

Need to test that within the next days. This was on a production system and I cannot break it again to get the output.
What PVE version are you testing against?

<!-- gh-comment-id:986540545 --> @DerDanilo commented on GitHub (Dec 6, 2021): > execute with parameter --debug and attach output. Need to test that within the next days. This was on a production system and I cannot break it again to get the output. What PVE version are you testing against?
Author
Owner

@franklupo commented on GitHub (Dec 6, 2021):

The version v1.11.0 is old. If so far the problem is something else. Have you updated Proxmox VE?

Best regards

<!-- gh-comment-id:986543238 --> @franklupo commented on GitHub (Dec 6, 2021): The version v1.11.0 is old. If so far the problem is something else. Have you updated Proxmox VE? Best regards
Author
Owner

@DerDanilo commented on GitHub (Dec 6, 2021):

The version v1.11.0 is old. If so far the problem is something else. Have you updated Proxmox VE?

As written before, we are using PVE 6.4.x in the cluster where the error appeared. This cluster cannot be updated at the moment. Please make notes to the tool version if compatibility to specific/older PVE versions ist lost. Thanks!

<!-- gh-comment-id:987002928 --> @DerDanilo commented on GitHub (Dec 6, 2021): > The version v1.11.0 is old. If so far the problem is something else. Have you updated Proxmox VE? As written before, we are using PVE 6.4.x in the cluster where the error appeared. This cluster cannot be updated at the moment. Please make notes to the tool version if compatibility to specific/older PVE versions ist lost. Thanks!
Author
Owner

@franklupo commented on GitHub (Dec 6, 2021):

Compatibility shouldn't be an issue. Try the latest version on a test machine. I use for development 6.4-13. There should be no problem.

<!-- gh-comment-id:987022547 --> @franklupo commented on GitHub (Dec 6, 2021): Compatibility shouldn't be an issue. Try the latest version on a test machine. I use for development 6.4-13. There should be no problem.
Author
Owner

@DerDanilo commented on GitHub (Dec 11, 2021):

To answer you question: Of course we will update PVE at a point, we just didn't do it yet.

cv4pve-autosnap: v1.13.2
pveversion: pve-manager/6.4-13/9f411e79 (running kernel: 5.4.143-1-pve)

Here is the debug output, stripped of sensitive data.

Method: POST, Url: https://pveapiendpoint:443/api2/json/access/ticket
Parameters:
password : xxxxxxxx
username : snapshots
realm : pve
StatusCode:          OK
ReasonPhrase:        OK
IsSuccessStatusCode: True
{
  "data": {
    "ticket": "PVE:snapshots@pve:xxxxxx",
    "username": "snapshots@pve",
    "cap": {
      "storage": {},
      "nodes": {},
      "sdn": {},
      "dc": {},
      "access": {},
      "vms": {
        "VM.Audit": 1,
        "VM.Snapshot": 1
      }
    },
    "CSRFPreventionToken": "xxxxx"
  }
}
=============================
ACTION Snap
VMs:              4030
Label:            ansible
Keep:             3
State:            False
Timeout:          30000
Timestamp format: yyMMddHHmmss
Max % Storage :   95%
Method: GET, Url: https://pveapiendpoint:443/api2/json/cluster/resources?type=vm
StatusCode:          OK
ReasonPhrase:        OK
IsSuccessStatusCode: True

...


=============================
Method: GET, Url: https://pveapiendpoint:443/api2/json/cluster/resources?type=storage
StatusCode:          OK
ReasonPhrase:        OK
IsSuccessStatusCode: True
{
  "data": []
}
=============================
================ EXCEPTION ================
System.IndexOutOfRangeException
Index was outside the bounds of the array.
   at BetterConsoleTables.Table.ToString(Int32[] columnLengths)
   at BetterConsoleTables.Table.ToString()
   at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows)
   at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows)
   at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage)
   at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
================ EXCEPTION ================
System.IndexOutOfRangeException
Index was outside the bounds of the array.
   at BetterConsoleTables.Table.ToString(Int32[] columnLengths)
   at BetterConsoleTables.Table.ToString()
   at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows)
   at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows)
   at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage)
   at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
<!-- gh-comment-id:991693559 --> @DerDanilo commented on GitHub (Dec 11, 2021): To answer you question: Of course we will update PVE at a point, we just didn't do it yet. cv4pve-autosnap: v1.13.2 pveversion: pve-manager/6.4-13/9f411e79 (running kernel: 5.4.143-1-pve) Here is the debug output, stripped of sensitive data. ``` Method: POST, Url: https://pveapiendpoint:443/api2/json/access/ticket Parameters: password : xxxxxxxx username : snapshots realm : pve StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": { "ticket": "PVE:snapshots@pve:xxxxxx", "username": "snapshots@pve", "cap": { "storage": {}, "nodes": {}, "sdn": {}, "dc": {}, "access": {}, "vms": { "VM.Audit": 1, "VM.Snapshot": 1 } }, "CSRFPreventionToken": "xxxxx" } } ============================= ACTION Snap VMs: 4030 Label: ansible Keep: 3 State: False Timeout: 30000 Timestamp format: yyMMddHHmmss Max % Storage : 95% Method: GET, Url: https://pveapiendpoint:443/api2/json/cluster/resources?type=vm StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True ... ============================= Method: GET, Url: https://pveapiendpoint:443/api2/json/cluster/resources?type=storage StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": [] } ============================= ================ EXCEPTION ================ System.IndexOutOfRangeException Index was outside the bounds of the array. at BetterConsoleTables.Table.ToString(Int32[] columnLengths) at BetterConsoleTables.Table.ToString() at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage) at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args) ================ EXCEPTION ================ System.IndexOutOfRangeException Index was outside the bounds of the array. at BetterConsoleTables.Table.ToString(Int32[] columnLengths) at BetterConsoleTables.Table.ToString() at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage) at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args) ```
Author
Owner

@franklupo commented on GitHub (Dec 11, 2021):

Hi,
The problem are the permiss

<!-- gh-comment-id:991697762 --> @franklupo commented on GitHub (Dec 11, 2021): Hi, The problem are the permiss
Author
Owner

@DerDanilo commented on GitHub (Dec 11, 2021):

The permission did not change and it was working fine in the past. Apparently the tool now also needs storage.audit permission.
Datastore.Audit VM.Audit VM.Snapshot --> With that it seems to work.

Maybe you can improve the output to let the user know that this might be a permission issue, also showing what permissions are required at least.
Also I could not find any information on how to configure the pve snapshot user in your documentation and also not in the Github readme. Can you please add that information?

Thanks!

<!-- gh-comment-id:991704791 --> @DerDanilo commented on GitHub (Dec 11, 2021): The permission did not change and it was working fine in the past. Apparently the tool now also needs storage.audit permission. `Datastore.Audit VM.Audit VM.Snapshot` --> With that it seems to work. Maybe you can improve the output to let the user know that this might be a permission issue, also showing what permissions are required at least. Also I could not find any information on how to configure the pve snapshot user in your documentation and also not in the Github readme. Can you please add that information? Thanks!
Author
Owner

@franklupo commented on GitHub (Dec 14, 2021):

Hi,
the required permissions are: VM.Audit, VM.Snapshot, Datastore.Audit, Pool.Allocate.
To update the documentation.

Best regards

<!-- gh-comment-id:993234328 --> @franklupo commented on GitHub (Dec 14, 2021): Hi, the required permissions are: VM.Audit, VM.Snapshot, Datastore.Audit, Pool.Allocate. To update the documentation. Best regards
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-autosnap#52
No description provided.