Very beginner question! I am having a really tough time initializing an array of uints. I have a test contract that consists of 1 line to test this and though it compiles, when I view the data in the public variable it throws a bigNumber error that I am not familiar with.

pragma solidity ^0.8.0;

contract Test {
    uint[2] public numberArray = [125,546];

This results in the following error when called: enter image description here

I receive the same error when I try and append to an empty array. I'm not sure how to add uints to an array. The contract was deployed to a JS VM if that matters.

I think it has to be something local because I have pasted in other's work and got the same error.

  • Can you share how you try to access numberArray ? Commented Nov 24, 2021 at 9:48

1 Answer 1


Try passing a parameter to the function call, like 0 to get the first element. It looks like you're trying to get the whole array using the default getter but that's not possible, you need to supply the index to return, or create a separate function that will return the whole array.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.