# Error when executing kickoff

**URL:** <https://community.crewai.com/t/error-when-executing-kickoff/717>\
**Category:** CrewAI Community Support\
**Created:** [October 10, 2024, 9:35pm UTC](https://community.crewai.com/t/error-when-executing-kickoff/717 "2024-10-10T21:35:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matheus896](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matheus896/32/217_2.png) [@matheus896](https://community.crewai.com/u/matheus896)\
**Post date:** [October 10, 2024, 9:35pm UTC](https://community.crewai.com/t/error-when-executing-kickoff/717/1 "2024-10-10T21:35:35Z")

</div>

```auto
---------------------------------------------------------------------------
AuthenticationError Traceback (most recent call last)
<ipython-input-152-e7adff2f7af2> in <cell line: 1>()
----> 1 result = crew.kickoff()

/usr/local/lib/python3.10/dist-packages/crewai/crew.py in kickoff(self, inputs)
    488 
    489 if self.process == Process.sequential:
--> 490 result = self._run_sequential_process()
    491 elif self.process == Process.hierarchical:
    492 result = self._run_hierarchical_process()

/usr/local/lib/python3.10/dist-packages/crewai/crew.py in _run_sequential_process(self)
    592 def _run_sequential_process(self) -> CrewOutput:
    593 """Executes tasks sequentially and returns the final output."""
--> 594 return self._execute_tasks(self.tasks)
    595 
    596 def _run_hierarchical_process(self) -> CrewOutput:

/usr/local/lib/python3.10/dist-packages/crewai/crew.py in _execute_tasks(self, tasks, start_index, was_replayed)
    690 
    691 context = self._get_context(task, task_outputs)
--> 692 task_output = task.execute_sync(
    693 agent=agent_to_use,
    694 context=context,

/usr/local/lib/python3.10/dist-packages/crewai/task.py in execute_sync(self, agent, context, tools)
    189 ) -> TaskOutput:
    190 """Execute the task synchronously."""
--> 191 return self._execute_core(agent, context, tools)
    192 
    193 @property

/usr/local/lib/python3.10/dist-packages/crewai/task.py in _execute_core(self, agent, context, tools)
    245 self.processed_by_agents.add(agent.role)
    246 
--> 247 result = agent.execute_task(
    248 task=self,
    249 context=context,

/usr/local/lib/python3.10/dist-packages/crewai/agent.py in execute_task(self, task, context, tools)
    212 self.crew._entity_memory,
    213 )
--> 214 memory = contextual_memory.build_context_for_task(task, context)
    215 if memory.strip() != "":
    216 task_prompt += self.i18n.slice("memory").format(memory=memory)

/usr/local/lib/python3.10/dist-packages/crewai/memory/contextual/contextual_memory.py in build_context_for_task(self, task, context)
     22 context = []
     23 context.append(self._fetch_ltm_context(task.description))
---> 24 context.append(self._fetch_stm_context(query))
     25 context.append(self._fetch_entity_context(query))
     26 return "\n".join(filter(None, context))

/usr/local/lib/python3.10/dist-packages/crewai/memory/contextual/contextual_memory.py in _fetch_stm_context(self, query)
     31 formatted as bullet points.
     32 """
---> 33 stm_results = self.stm.search(query)
     34 formatted_results = "\n".join([f"- {result}" for result in stm_results])
     35 return f"Recent Insights:\n{formatted_results}" if stm_results else ""

/usr/local/lib/python3.10/dist-packages/crewai/memory/short_term/short_term_memory.py in search(self, query, score_threshold)
     35 
     36 def search(self, query: str, score_threshold: float = 0.35):
---> 37 return self.storage.search(query=query, score_threshold=score_threshold) # type: ignore # BUG? The reference is to the parent class, but the parent class does not have this parameters
     38 
     39 def reset(self) -> None:

/usr/local/lib/python3.10/dist-packages/crewai/memory/storage/rag_storage.py in search(self, query, limit, filter, score_threshold)
    101 self.app.search(query, limit, where=filter)
    102 if filter
--> 103 else self.app.search(query, limit)
    104 )
    105 except InvalidDimensionException:

/usr/local/lib/python3.10/dist-packages/embedchain/embedchain.py in search(self, query, num_documents, where, raw_filter, namespace)
    710 }
    711 
--> 712 return [{"context": c[0], "metadata": c[1]} for c in self.db.query(**params)]
    713 
    714 def set_collection_name(self, name: str):

/usr/local/lib/python3.10/dist-packages/embedchain/vectordb/chroma.py in query(self, input_query, n_results, where, raw_filter, citations, **kwargs)
    218 where_clause = self._generate_where_clause(where)
    219 try:
--> 220 result = self.collection.query(
    221 query_texts=[
    222 input_query,

/usr/local/lib/python3.10/dist-packages/chromadb/api/models/Collection.py in query(self, query_embeddings, query_texts, query_images, query_uris, n_results, where, where_document, include)
    325 if valid_query_embeddings is None:
    326 if query_texts is not None:
--> 327 valid_query_embeddings = self._embed(input=valid_query_texts)
    328 elif query_images is not None:
    329 valid_query_embeddings = self._embed(input=valid_query_images)

/usr/local/lib/python3.10/dist-packages/chromadb/api/models/Collection.py in _embed(self, input)
    631 "https://docs.trychroma.com/embeddings"
    632 )
--> 633 return self._embedding_function(input=input)

/usr/local/lib/python3.10/dist-packages/chromadb/api/types.py in __call__ (self, input)
    191 
    192 def __call__ (self: EmbeddingFunction[D], input: D) -> Embeddings:
--> 193 result = call(self, input)
    194 return validate_embeddings(maybe_cast_one_to_many_embedding(result))
    195 

/usr/local/lib/python3.10/dist-packages/chromadb/utils/embedding_functions.py in __call__ (self, input)
    186 # Call the OpenAI Embedding API
    187 if self._v1:
--> 188 embeddings = self._client.create(
    189 input=input, model=self._deployment_id or self._model_name
    190 ).data

/usr/local/lib/python3.10/dist-packages/openai/resources/embeddings.py in create(self, input, model, dimensions, encoding_format, user, extra_headers, extra_query, extra_body, timeout)
    122 return obj
    123 
--> 124 return self._post(
    125 "/embeddings",
    126 body=maybe_transform(params, embedding_create_params.EmbeddingCreateParams),

/usr/local/lib/python3.10/dist-packages/openai/_base_client.py in post(self, path, cast_to, body, options, files, stream, stream_cls)
   1275 method="post", url=path, json_data=body, files=to_httpx_files(files), **options
   1276 )
-> 1277 return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
   1278 
   1279 def patch(

/usr/local/lib/python3.10/dist-packages/openai/_base_client.py in request(self, cast_to, options, remaining_retries, stream, stream_cls)
    952 retries_taken = 0
    953 
--> 954 return self._request(
    955 cast_to=cast_to,
    956 options=options,

/usr/local/lib/python3.10/dist-packages/openai/_base_client.py in _request(self, cast_to, options, retries_taken, stream, stream_cls)
   1056 
   1057 log.debug("Re-raising status error")
-> 1058 raise self._make_status_error_from_response(err.response) from None
   1059 
   1060 return self._process_response(

AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: fake. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

```

hello everyone, can someone help me with this error when I run crew.kickoff()

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [October 11, 2024, 3:03am UTC](https://community.crewai.com/t/error-when-executing-kickoff/717/2 "2024-10-11T03:03:34Z")

</div>

The information you need is on the last line, check how you are setting up your crew

---

<div class="post-metadata">

**Author:** ![rokbenko](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rokbenko/32/492_2.png) [@rokbenko](https://community.crewai.com/u/rokbenko)\
**Post date:** [October 11, 2024, 9:02pm UTC](https://community.crewai.com/t/error-when-executing-kickoff/717/3 "2024-10-11T21:02:23Z")

</div>

@matheus896 Please edit your question and add the code so that we can help you debug it.

But as mentioned above, see the following line at the bottom of the traceback:

> AuthenticationError: Error code: 401 - {‘error’: {‘message’: ‘Incorrect API key provided: fake. You can find your API key at [https://platform.openai.com/account/api-keys.](https://platform.openai.com/account/api-keys.)’, ‘type’: ‘invalid\_request\_error’, ‘param’: None, ‘code’: ‘invalid\_api\_key’}}
