# AI embeddings backfill rake aborted

**URL:** <https://meta.discourse.org/t/ai-embeddings-backfill-rake-aborted/293120>\
**Category:** Product Support\
**Tags:** ai\
**Created:** [January 27, 2024, 6:10am UTC](https://meta.discourse.org/t/ai-embeddings-backfill-rake-aborted/293120 "2024-01-27T06:10:13Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)\
**Post date:** [January 27, 2024, 6:10am UTC](https://meta.discourse.org/t/ai-embeddings-backfill-rake-aborted/293120/1 "2024-01-27T06:10:13Z")

</div>

Hello 👋

I started use Discourse Ai - OpenAi API. First I seted up it to Related Topics (`text-embedding-ada-002`). When I try to run the [rake task for backfill](https://meta.discourse.org/t/discourse-ai-embeddings/259603/8). I’ve got the following error.

```plaintext
....rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass (NoMethodError)

          response[:data].first[:embedding]
                  ^^^^^^^
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/text_embedding_ada_002.rb:37:in `vector_from'
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:145:in `generate_representation_from'
/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:19:in `block (2 levels) in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `block in find_each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:245:in `block in in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `loop'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:137:in `find_in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:70:in `find_each'
/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:17:in `block in <main>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => ai:embeddings:backfill

```

And also see the followings in `/logs`.  
 ![Screenshot 2024-01-27 at 7.09.32](https://global.discourse-cdn.com/meta/optimized/4X/9/1/3/9138214737a91a1f6b9d55ea78a2e17bcfa8342f_2_690x40.png)

Thanks for the help! 🙂

---

_[View the full topic](https://meta.discourse.org/t/ai-embeddings-backfill-rake-aborted/293120)._
