What may cause Undefined index in drupal_retrieve_form when uploading an image? I have a developed custom plugin in my Drupal 7.54 site for panels where user can upload image. It works locally, however when I trigger same functionality on production nothing happens and I see in logs following errors.

Notice: Undefined index: hero_block_search_box_edit_form in drupal_retrieve_form() (line 807 of /Users/dpa/Sites/e1/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'hero_block_search_box_edit_form' not found or invalid function name in drupal_retrieve_form() (line 842 of 
/Users/dpa/Sites/e1/includes/form.inc).
Notice: Undefined index: content in file_ajax_upload() (line 271 of /Users/dpa/Sites/e1/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /Users/dpa/Sites/econ-websites/econ1/modules/file/file.module).
Notice: Undefined index: #prefix in file_ajax_upload() (line 283 of /Users/dpa/Sites/econ-websites/econ1/modules/file/file.module).


I read about similar issues in google any many people say it could be related to permissions (and it has sense, since locally everything works but not on production side).

Would anybody give me a hint where to look?
You need to either move hero_block_search_box_edit_form() from hero_block_search_box.inc to your .module file, or at the top of your form definition (or hook_form_alter() if that's what you are using), you need to add the following:

form_load_include($form_state, 'inc', MODULENAME, 'hero_block_search_box');


where MODULENAME is the module key (machine name) of your module. Make sure you don't include the .inc in the last parameter - I didn't forget it, I left it out on purpose.