{"record":{"id":"88c6b109f8f088e3","repo":"chroma-core/chroma","slug":"missing-required-arguments-join-arg-name-f","errorCode":null,"errorMessage":"Missing required arguments: {', '.join([arg.name for arg in missing_args])}. Please provide them or set the environment variables: {', '.join([arg.env_var for arg in missing_args])}","messagePattern":"Missing required arguments: (.+?)\\. Please provide them or set the environment variables: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/__init__.py","lineNumber":413,"sourceCode":"    Returns:\n        ClientAPI: A configured client instance.\n\n    Raises:\n        ValueError: If no API key is provided or available in the environment.\n    \"\"\"\n\n    required_args = [\n        CloudClientArg(name=\"api_key\", env_var=\"CHROMA_API_KEY\", value=api_key),\n    ]\n\n    # If api_key is not provided, try to load it from the environment variable\n    if not all([arg.value for arg in required_args]):\n        for arg in required_args:\n            arg.value = arg.value or os.environ.get(arg.env_var)\n\n    missing_args = [arg for arg in required_args if arg.value is None]\n    if missing_args:\n        raise ValueError(\n            f\"Missing required arguments: {', '.join([arg.name for arg in missing_args])}. \"\n            f\"Please provide them or set the environment variables: {', '.join([arg.env_var for arg in missing_args])}\"\n        )\n\n    if settings is None:\n        settings = Settings()\n\n    # Make sure paramaters are the correct types -- users can pass anything.\n    tenant = tenant or os.environ.get(\"CHROMA_TENANT\")\n    if tenant is not None:\n        tenant = str(tenant)\n    database = database or os.environ.get(\"CHROMA_DATABASE\")\n    if database is not None:\n        database = str(database)\n    api_key = str(api_key)\n    cloud_host = str(cloud_host)\n    cloud_port = int(cloud_port)\n    enable_ssl = bool(enable_ssl)","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/__init__.py#L395-L431","documentation":"CloudClient() requires an API key for Chroma Cloud. It first checks the api_key argument, then falls back to os.environ['CHROMA_API_KEY']; if neither is present it raises ValueError listing the missing argument names and the environment variables to set (chromadb/__init__.py:407-413). CHROMA_TENANT and CHROMA_DATABASE are optional and resolved afterwards, so only a missing api_key triggers this.","triggerScenarios":"CloudClient() with no api_key argument and no CHROMA_API_KEY in the environment; a typo'd variable name such as CHROMA_APIKEY; a .env file that was never loaded in the deployed runtime.","commonSituations":"Works locally (key exported in the shell) but fails in CI, containers, or serverless where env vars are not propagated; key-rotation scripts that unset the variable before recreating the client.","solutions":["Pass the key explicitly: CloudClient(api_key=...)","Or export CHROMA_API_KEY in the runtime environment (load .env before constructing the client)","Fail fast at startup by checking presence without printing the value: python -c \"import os; print(bool(os.environ.get('CHROMA_API_KEY')))\""],"exampleFix":"# before\nclient = CloudClient()  # ValueError: Missing required arguments: api_key\n\n# after\nimport os\nclient = CloudClient(api_key=os.environ['CHROMA_API_KEY'])","handlingStrategy":"validation","validationCode":"import os\n\napi_key = os.environ.get('CHROMA_API_KEY')\nif not api_key:\n    raise RuntimeError(\n        'CHROMA_API_KEY is not set; export it or pass api_key= to CloudClient'\n    )\nclient = chromadb.CloudClient(api_key=api_key)","typeGuard":null,"tryCatchPattern":"try:\n    client = chromadb.CloudClient()\nexcept ValueError as e:\n    if 'Missing required arguments' in str(e):\n        # prompt for the key / abort deployment with a clear message;\n        # do NOT hardcode the key as a fallback\n        raise\n    raise","preventionTips":["Fail fast at startup: assert the key's presence before creating the client","Manage CHROMA_API_KEY through the platform's secret store (env injection), never in code","Check presence with bool(os.environ.get('CHROMA_API_KEY')) — never print the value"],"tags":["python","cloud","authentication","api-key","env-vars"],"backgroundTag":"missing-api-key","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}