Self-assembling materials are the building blocks for bottom-up nanofabrication processes, but many self-assembled nanostructures contain defects and lack sufficient long-range order for certain nanotechnology applications. Here we investigate the formation of defects in a self-assembled array of spherical block-copolymer microdomains, using topographical templates to control the local self-assembly. Perfect ordered sphere arrays can form in both constant-width templates and width-modulated templates. For modulated templates, transition between configurations having a constant number of rows and configurations of stable arrays with varying numbers of rows is shown to be analogous to dislocation formation in an epitaxial thin film system. Based on the configuration transition energy and fluctuation energy, designed templates with a high tolerance for lithographical imperfections can direct precisely modulated block-copolymer nanostructures. This study provides insights into the design of hybrid systems combining top-down and bottom-up fabrication.