title: Error in Programmatically creating Taxonomy in drupal
body: <p>I'm getting the below error while building taxonomy voccabulary and terms using the following code</p>
  
  <blockquote>
    <p>FieldException: Attempt to create an instance of a field field_my_custom_vocab002 that doesn't exist or is currently inactive. in field_create_instance() (line 476 of C:\wamp\www\pur_theme\modules\field\field.crud.inc).</p>
  </blockquote>
  
  <p>I checked the voccabulary and it is created, the problem is only with term creation</p>
  
  <h1>code</h1>
  
  <pre><code>&lt;?php
  
  $new_vocab = (object) array(
      'name' =&gt; 'My custom vocabulary002',
      'description' =&gt; 'Test',
      'machine_name' =&gt; 'my_custom_vocab002',
    );
  taxonomy_vocabulary_save($new_vocab);
  
  $vocab = taxonomy_vocabulary_machine_name_load('my_custom_vocab002');
  
  $term1 = (object) array(
     'name' =&gt; 'Term 1',
      'description' =&gt; 'This is term 1',
     'vid' =&gt; $vocab-&gt;vid,
  );
  
  taxonomy_term_save($term1);
  </code></pre>
  
  <p>What/where did I wrong? </p>