What is causing this error? (render.bake issue)

I’m having this annoying problem where bake never works no matter what I do. So I thought I’d actually try to debug it instead of deleting startup files and the usual stuff. I get the error “you should have active texture for multires baking”. The thing is I do have an active texture and the image is there and valid.

So I decided to execute the bake from the console and here’s what happens:


>>> bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage_object="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_cage=False, use_split_materials=False, use_automatic_name=False)
Error: No active image found in material "Material" (0) for object "irregular_ref"


Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender\2.71\scripts\modules\bpy\ops.py", line 188, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: No active image found in material "Material" (0) for object "irregular_ref"


>>> bpy.context.active_object
bpy.data.objects['irregular_ref']

>>> bpy.context.active_object.active_material
bpy.data.materials['Material']

>>> bpy.context.active_object.active_material.active_texture
bpy.data.textures['Texture']

>>> bpy.context.active_object.active_material.active_texture.image
bpy.data.images['irregular_normals_blender']

>>> str(bpy.data.images["irregular_normals_blender"].pixels)
'<bpy_float[4194304], Image.pixels>'

>>> str(bpy.data.images["irregular_normals_blender"].size)
'<bpy_int[2], Image.size>'

I don’t understand the organization of the code well enough to be able to figure out where to look in the code. (ops.py seems to just be the base class for all operators, and I’m guessing that maybe ops_module is implemented in C/C++?)

Any idea how to debug this? I can share the Blender file.

This is actually not my code that I’m working on here (I wasn’t working on a script when this happened, though maybe some problem was triggered by an addon of some sort.)