{"record":{"id":"e1007b86985b4a6a","repo":"crewAIInc/crewAI","slug":"you-are-missing-the-weaviate-client-package-wou","errorCode":null,"errorMessage":"You are missing the 'weaviate-client' package. Would you like to install it?","messagePattern":"You are missing the 'weaviate-client' package\\. Would you like to install it\\?","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/weaviate_tool/vector_search.py","lineNumber":102,"sourceCode":"    )\n\n    def __init__(self, **kwargs: Any) -> None:\n        super().__init__(**kwargs)\n        if WEAVIATE_AVAILABLE:\n            openai_api_key = os.environ.get(\"OPENAI_API_KEY\")\n            if not openai_api_key:\n                raise ValueError(\n                    \"OPENAI_API_KEY environment variable is required for WeaviateVectorSearchTool and it is mandatory to use the tool.\"\n                )\n            self.headers = {\"X-OpenAI-Api-Key\": openai_api_key}\n        else:\n            if click.confirm(\n                \"You are missing the 'weaviate-client' package. Would you like to install it?\"\n            ):\n                subprocess.run([\"uv\", \"pip\", \"install\", \"weaviate-client\"], check=True)  # noqa: S607\n\n            else:\n                raise ImportError(\n                    \"You are missing the 'weaviate-client' package. Would you like to install it?\"\n                )\n\n    def _run(self, query: str) -> str:\n        if not WEAVIATE_AVAILABLE:\n            raise ImportError(\n                \"You are missing the 'weaviate-client' package. Would you like to install it?\"\n            )\n\n        if not self.weaviate_cluster_url or not self.weaviate_api_key:\n            raise ValueError(\"WEAVIATE_URL or WEAVIATE_API_KEY is not set\")\n\n        client = weaviate.connect_to_weaviate_cloud(\n            cluster_url=self.weaviate_cluster_url,\n            auth_credentials=Auth.api_key(self.weaviate_api_key),\n            headers=self.headers,\n        )\n        internal_docs = client.collections.get(self.collection_name)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/weaviate_tool/vector_search.py#L84-L120","documentation":"When the optional 'weaviate-client' package is not importable, WeaviateVectorSearchTool's __init__ interactively asks to install it. If you decline (click.confirm False), it raises ImportError whose text is the question itself - a known copy/paste artifact of the interactive path.","triggerScenarios":"Constructing WeaviateVectorSearchTool in an environment without weaviate-client and answering 'n' to the prompt, or running non-interactively (stdin closed/EOF) so click.confirm declines by default.","commonSituations":"Automated scripts/CI where no one can answer the prompt; minimal crewai-tools installs; piping input that yields a non-'y' first char.","solutions":["Install the package: uv pip install weaviate-client (or pip install weaviate-client) before running.","Add weaviate-client to project dependencies so the prompt never triggers.","For deployments, never rely on interactive install - bake deps into the image."],"exampleFix":"# before\nWeaviateVectorSearchTool(...)  # non-interactive -> prompt declined -> ImportError\n\n# after\n# shell: pip install weaviate-client\n# plus: export OPENAI_API_KEY=...\nWeaviateVectorSearchTool(\n    weaviate_cluster_url='https://...', weaviate_api_key='...'\n)","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif not importlib.util.find_spec('weaviate'):\n    raise SystemExit('weaviate-client missing: pip install weaviate-client')","typeGuard":null,"tryCatchPattern":"try:\n    tool = WeaviateVectorSearchTool(\n        weaviate_cluster_url=URL, weaviate_api_key=WKEY\n    )\nexcept ImportError as e:\n    raise SystemExit(f'Install weaviate-client and restart: {e}')","preventionTips":["Pre-install weaviate-client in the image; never depend on interactive prompts.","Check find_spec('weaviate') at startup alongside env var checks.","Run crews non-interactively (stdin closed) so prompts fail loudly, not silently."],"tags":["dependencies","installation","weaviate","interactive-prompt"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}