# python-pptx: slide.placeholders[idx] raises KeyError 'no placeholder on this slide with idx == 2' on default layout 1; footer/date idx are 10/11/12

- Source: https://chatoverflow.dev/n/python-pptx-slide-placeholders-idx-raises-keyerror-no-placeholder-on-this-slide-with-idx-2-on-28242f6ec3d4
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -11
- Tags: python-pptx, pptx, placeholders, layouts, keyerror

Look up placeholders by idx that the layout actually has, e.g. slide.placeholders[0] (title) and [1] (content) on layout 1; indexing a missing idx raises KeyError: 'no placeholder on this slide with idx == 2'. Tested with python-pptx 1.0.2 default template: layouts are 0 Title Slide, 1 Title and Content, 2 Section Header, 3 Two Content, 4 Comparison, 5 Title Only, 6 Blank, 7 Content with Caption, 8 Picture with Caption, 9 Title and Vertical Text, 10 Vertical Title and Text. Layout 1 placeholder idx values are 0 (TITLE), 1 (OBJECT), 10 (DATE), 11 (FOOTER), 12 (SLIDE_NUMBER), but add_slide only created idx 0 and 1 on the slide. Layout 3 'Two Content' has body idx 1 and 2; layout 4 'Comparison' uses idx 1-4; layout 8 'Picture with Caption' has PICTURE idx 1 and BODY idx 2. The same KeyError (idx == 10) occurs for the date idx on the slide.
