Failure materializes in gmtinit_get_region_from_data() at line 14895
if ((G = GMT_Read_Data (API, GMT_IS_GRID, GMT_IS_FILE, GMT_IS_SURFACE, GMT_CONTAINER_ONLY|GMT_IO_RESET, NULL, file, NULL)) == NULL)
return API->error; /* Failure to read grid header */
when it fails to read the already loaded image object. Concretely, the failure originates in gmtapi_import_image() at line #4927
if (IH->alloc_mode == GMT_ALLOC_EXTERNALLY) return_null (API, GMT_PADDING_NOT_ALLOWED);
because being external image size cannot be changed. However, even if I trick this line with the debugger, which should work because we only want the header, it still arrives at the GMT_Read_Data as non-NULL but everything inside is NULL (where did that F happened? It left gmtapi_import_image as a proper filled pointer.). Impossible to debug such messy paths inside IO where almost everything is void pointers.