{"record":{"id":"7fb96de3955db0a6","repo":"chroma-core/chroma","slug":"the-project-cannot-be-changed-after-the-embedding","errorCode":null,"errorMessage":"The project cannot be changed after the embedding function has been initialized.","messagePattern":"The project cannot be changed after the embedding function has been initialized\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/google_embedding_function.py","lineNumber":187,"sourceCode":"        return config\n\n    def validate_config_update(\n        self, old_config: Dict[str, Any], new_config: Dict[str, Any]\n    ) -> None:\n        if \"model_name\" in new_config:\n            raise ValueError(\n                \"The model name cannot be changed after the embedding function has been initialized.\"\n            )\n        if \"dimension\" in new_config:\n            raise ValueError(\n                \"The dimension cannot be changed after the embedding function has been initialized.\"\n            )\n        if \"vertexai\" in new_config:\n            raise ValueError(\n                \"The vertexai cannot be changed after the embedding function has been initialized.\"\n            )\n        if \"project\" in new_config:\n            raise ValueError(\n                \"The project cannot be changed after the embedding function has been initialized.\"\n            )\n        if \"location\" in new_config:\n            raise ValueError(\n                \"The location cannot be changed after the embedding function has been initialized.\"\n            )\n\n    @staticmethod\n    def validate_config(config: Dict[str, Any]) -> None:\n        \"\"\"\n        Validate the configuration using the JSON schema.\n\n        Args:\n            config: Configuration to validate\n\n        Raises:\n            ValidationError: If the configuration does not match the schema\n        \"\"\"","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/google_embedding_function.py#L169-L205","documentation":"GoogleGeminiEmbeddingFunction.validate_config_update rejects update payloads containing a 'project' key. The GCP project id is bound into the genai.Client at construction and determines billing/quota for Vertex deployments; changing it after initialization is not supported, so it is validated as immutable.","triggerScenarios":"Attempting to move a Vertex-backed embedding function to another GCP project via config update; including 'project' in a payload built from ef.get_config() (which always emits the key).","commonSituations":"Reorganizing GCP projects or migrating billing accounts and trying to repoint an existing deployment in place; full-config copy used as an update payload.","solutions":["Rebuild the embedding function and collection against the new project and re-embed","Remove the 'project' key from update payloads that only change mutable fields","Keep project/location/model decisions stable per collection lifecycle"],"exampleFix":"# before\nnew_config = ef.get_config()  # contains \"project\": \"old-project\"\nnew_config[\"api_key_env_var\"] = \"GOOGLE_API_KEY\"\nef.validate_config_update(old, new_config)  # ValueError: project immutable\n\n# after\nnew_config = {\"api_key_env_var\": \"GOOGLE_API_KEY\"}\nef.validate_config_update(old, new_config)","handlingStrategy":"validation","validationCode":"IMMUTABLE = {\"model_name\", \"dimension\", \"vertexai\", \"project\", \"location\"}\n\nupdate = {k: v for k, v in desired_config.items() if k not in IMMUTABLE}\nassert \"project\" not in update\nef.validate_config_update(old_config, update)","typeGuard":"from typing import Any, TypeGuard\n\nMUTABLE_GEMINI_KEYS = {\"api_key_env_var\", \"task_type\"}\n\ndef is_mutable_update(cfg: Any) -> TypeGuard[dict]:\n    return isinstance(cfg, dict) and set(cfg) <= MUTABLE_GEMINI_KEYS","tryCatchPattern":null,"preventionTips":["Pin the GCP project for the lifetime of the collection's embeddings","Filter immutable keys from any config update pipeline","Project migrations = new collection + re-embed"],"tags":["immutable-config","gcp-project","vertexai","chroma"],"backgroundTag":"immutable-config-field","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}