Another cause: store_result() cannot be called twice.
For instance, in the following code, Error 5 is printed.
<?php
$db = new mysqli("localhost", "something", "something", "something");
$stmt = $db->stmt_init();
if ($stmt->error) printf("Error 1 : %s\n", $stmt->error);
$stmt->prepare("select 1");
if ($stmt->error) printf("Error 2 : %s\n", $stmt->error);
$stmt->execute();
if ($stmt->error) printf("Error 3 : %s\n", $stmt->error);
$stmt->store_result();
if ($stmt->error) printf("Error 4 : %s\n", $stmt->error);
$stmt->store_result();
if ($stmt->error) printf("Error 5 : %s\n", $stmt->error);
(This may not be relevant to the original sample code, but it can be relevant to people seeking answers to this error.)