diff -u a\entityreference.module b\entityreference.module
--- a\entityreference.module	Mon Feb 13 23:59:35 2012
+++ b\entityreference.module	Fri Feb 24 09:20:49 2012
@@ -198,6 +198,25 @@
     return;
   }
 
+  // Check for invalid autocomplete input.
+  if (isset($instance['widget']['type']) && $instance['widget']['type'] == 'entityreference_autocomplete') {
+    foreach ($items as $delta => $item) {
+      // If the field is empty then drupal form validation has already flagged
+      // empty required fields.
+      // If it is null, then there is a value, but not a valid one. @see
+      // _entityreference_autocomplete_validate().
+      if (is_null($item['target_id'])) {
+        $errors[$field['field_name']][$langcode][$delta][] = array(
+          'error' => 'entityreference_invalid_entity',
+          'message' => t('@field field contains invalid @type.', array(
+            '@field' => $instance['label'],
+            '@type' => $field['settings']['target_type'],
+          )),
+        );
+      }
+    }
+  }
+  // Check if the reference is valid.
   $valid_ids = entityreference_get_selection_handler($field, $instance)->validateReferencableEntities(array_keys($ids));
 
   $invalid_entities = array_diff_key($ids, array_flip($valid_ids));
@@ -644,6 +663,44 @@
     // Take "label (entity id)', match the id from parenthesis.
     if (preg_match("/.+\((\d+)\)/", $element['#value'], $matches)) {
       $value = $matches[1];
+    }
+    else {
+      // Try to get a match from the input string when the user didn't use the
+      // autocomplete but filled in a value manually.
+      $field_name = $element['#field_name'];
+      $field = field_info_field($field_name);
+      $handler = entityreference_get_selection_handler($field);
+      $entities = $handler->getReferencableEntities($element['#value'], '=', 6);
+      if (! empty($entities)) {
+        if (count($entities) > 5) {
+          // Error if there are more than 5 matching entities.
+          form_error($element, t('Many entities are called %value. Specify the one you want by appending the id in parentheses, like "@value (@id)"', array(
+            '%value' => $element['#value'],
+            '@value' => $element['#value'],
+            '@id' => key($entities),
+          )));
+        }
+        elseif (count($entities) > 1) {
+          // More helpful error if there are only a few matching entities.
+          $multiples = array();
+          foreach ($entities as $id => $name) {
+            $multiples[] = $name . ' (' . $id . ')';
+          }
+          form_error($element, t('Multiple entities match this reference: %multiple', array(
+            '%multiple' => implode(', ', $multiples),
+          )));
+        }
+        else {
+          // Take the one and only matching entity.
+          $value = key($entities);
+        }
+      }
+      else {
+        // No matching entities found.
+        // Set value to NULL rather than an empty string to distinguish this
+        // case in the hook_field_validate().
+        $value = NULL;
+      }
     }
   }
 
