better error message when failing to set array value