I'm learning entityfieldquery api

I wrote a simple module

function demo_menu() {
  $items = array();
  $items['demo'] = array(
    'page callback' => 'demo_list',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  return $items;

function demo_list() {
  $query=  new EntityFieldQuery();

  $result = $query->entityCondition('entity_type ', 'node')


I got this error

EntityFieldQueryException: For this query an entity type must be specified. in EntityFieldQuery->propertyQuery() (line 1195 of C:\openserver\domains\drupal7.localhost\includes\entity.inc).

I read many articles. This is the most simplest query but it is not working.

  • I am closing this question as the error is a typo in the condition used; "entity_type " is not a condition the EntityFieldQuery class understands. Questions where the error is a typo are too localized questions.
    – apaderno
    Dec 29, 2012 at 17:31

1 Answer 1


Just got the error. remove space from "entity_type "
from this line
$result = $query->entityCondition('entity_type ', 'node') ->execute();


Not the answer you're looking for? Browse other questions tagged or ask your own question.