# IndexError: list index out of range for GCE dynamic inventory

**URL:** <https://forum.ansible.com/t/indexerror-list-index-out-of-range-for-gce-dynamic-inventory/17276>\
**Category:** Ansible Project\
**Created:** [January 15, 2015, 2:15am UTC](https://forum.ansible.com/t/indexerror-list-index-out-of-range-for-gce-dynamic-inventory/17276 "2015-01-15T02:15:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![harsh001](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@harsh001](https://forum.ansible.com/u/harsh001)\
**Post date:** [January 15, 2015, 2:15am UTC](https://forum.ansible.com/t/indexerror-list-index-out-of-range-for-gce-dynamic-inventory/17276/1 "2015-01-15T02:15:53Z")

</div>

When running the dynamic inventory script against a gce deployment , some nodes with external ips some without (running connecting through NAT ) i encounter this error when running list:

sh-3.2# ./inventory/gce/gce.py --list  
Traceback (most recent call last):  
File “./inventory/gce/gce.py”, line 287, in   
GceInventory()  
File “./inventory/gce/gce.py”, line 111, in **init**  
print(self.json\_format\_dict(self.group\_instances(),  
File “./inventory/gce/gce.py”, line 242, in group\_instances  
meta[“hostvars”][name] = self.node\_to\_dict(node)  
File “./inventory/gce/gce.py”, line 214, in node\_to\_dict  
‘gce\_public\_ip’: inst.public\_ips[0],  
IndexError: list index out of range

only happens when there are nodes without external ips.When given temporary external ips the dynamic inventory proceeds as expected.Not sure if a bug in the gce.py script or elsewhere.
