I am not very sure why it happens, most of time, it works fine, but rarely when I trigger a AHAH, return back some errors from form API.
I trigger this error by clear table "cache_form", then trigger AHAH.
I solved this bug by modify ahah_helper_render function.
I don't think form cache is a reliable way to get the form array.
I imitate drupal_get_form, add some code to ahah_helper_render function. please judge it, the code just work for me, even when I clear table "cache_form" manually.
// Get the form from the cache.
$form = form_get_cache($form_build_id, $form_state);
// hack to solve if the cache is gone
if (!$form) {
$form_id = $_POST['form_id'];
$form_state['post'] = $_POST;
// Use a copy of the function's arguments for manipulation
$args_temp = array();
$args_temp[0] = &$form_state;
array_unshift($args_temp, $form_id);
$form = call_user_func_array('drupal_retrieve_form', $args_temp);
$form_build_id = 'form-'. md5(uniqid(mt_rand(), true));
$form['#build_id'] = $form_build_id;
drupal_prepare_form($form_id, $form, $form_state);
unset($form_state['post']);
}