{"record":{"id":"3608f655c6ba412d","repo":"chroma-core/chroma","slug":"missing-api-base-in-configuration-for-basetenemb","errorCode":null,"errorMessage":"Missing 'api_base' in configuration for BasetenEmbeddingFunction.","messagePattern":"Missing 'api_base' in configuration for BasetenEmbeddingFunction\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"info","filePath":"chromadb/utils/embedding_functions/baseten_embedding_function.py","lineNumber":95,"sourceCode":"        Args:\n            config (Dict[str, Any]): A dictionary containing the configuration parameters.\n                                     Expected keys: 'api_key', 'api_base', 'api_key_env_var'.\n\n        Returns:\n            BasetenEmbeddingFunction: An instance of BasetenEmbeddingFunction.\n        \"\"\"\n        api_key_env_var = config.get(\"api_key_env_var\")\n        api_base = config.get(\"api_base\")\n        if api_key_env_var is None or api_base is None:\n            raise ValueError(\n                \"Missing 'api_key_env_var' or 'api_base' in configuration for BasetenEmbeddingFunction.\"\n            )\n\n        # Note: We rely on the __init__ method to handle potential missing api_key\n        # by checking the environment variable if the config value is None.\n        # However, api_base must be present either in config or have a default.\n        if api_base is None:\n            raise ValueError(\n                \"Missing 'api_base' in configuration for BasetenEmbeddingFunction.\"\n            )\n\n        return BasetenEmbeddingFunction(\n            api_key=None,  # Pass None if not in config, __init__ will check env var\n            api_base=api_base,\n            api_key_env_var=api_key_env_var,\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:","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/baseten_embedding_function.py#L77-L113","documentation":"This is a redundant second check in BasetenEmbeddingFunction.build_from_config: the immediately preceding combined check (lines 86-89) already raised when api_base is None, so the `if api_base is None` at line 94 can never be true. As shipped, this branch is unreachable dead code — users who see the message \"Missing 'api_base' in configuration...\" actually hit the earlier combined check. Its remediation is therefore identical to the line-87 error.","triggerScenarios":"No code path in the current version can trigger this raise; it would only fire if the combined check above it were removed or relaxed in a future edit.","commonSituations":"Developers or static analyzers grepping the message find two raise sites and waste time distinguishing them; code-coverage tools report the line as uncovered.","solutions":["If you encountered this message at runtime, you actually hit the earlier check — fix the config to include both api_key_env_var and api_base (see the line-87 error).","Upstream cleanup: delete the unreachable second check or merge it into the first so there is one authoritative message.","No action needed otherwise; this path cannot execute."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# The raise at this line is unreachable; guard against the real (line-87) check instead\nif not (\"api_key_env_var\" in cfg and \"api_base\" in cfg):\n    raise ValueError(\"baseten config requires api_key_env_var and api_base\")\nef = config_to_embedding_function({\"name\": \"baseten\", \"config\": cfg})","typeGuard":"def is_complete_baseten_config(cfg: object) -> bool:\n    return isinstance(cfg, dict) and \"api_key_env_var\" in cfg and \"api_base\" in cfg","tryCatchPattern":"try:\n    ef = config_to_embedding_function(cfg)\nexcept ValueError as e:\n    if \"api_base\" in str(e) or \"api_key_env_var\" in str(e):\n        raise RuntimeError(\"Incomplete baseten config: supply both api_base and api_key_env_var\") from e\n    raise","preventionTips":["Handle both raise sites with one message-based branch since their texts overlap.","Do not rely on distinguishing which line threw — both mean an incomplete baseten config.","Cover config round-trips in tests so upstream refactors of this dead code cannot regress you."],"tags":["python","baseten","dead-code","config","static-analysis","chromadb"],"backgroundTag":"missing-config-field","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}