{"record":{"id":"5d044e4e8ea5ea9b","repo":"BerriAI/litellm","slug":"bitbucket-config-is-required-for-bitbucket-prompt","errorCode":null,"errorMessage":"bitbucket_config is required for BitBucket prompt integration","messagePattern":"bitbucket_config is required for BitBucket prompt integration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/bitbucket/__init__.py","lineNumber":41,"sourceCode":"                - workspace: BitBucket workspace name\n                - repository: Repository name\n                - access_token: BitBucket access token\n                - branch: Branch to fetch prompts from (default: main)\n    \"\"\"\n    import litellm\n\n    litellm.global_bitbucket_config = config\n\n\ndef prompt_initializer(litellm_params: \"PromptLiteLLMParams\", prompt_spec: \"PromptSpec\") -> \"CustomPromptManagement\":\n    \"\"\"\n    Initialize a prompt from a BitBucket repository.\n    \"\"\"\n    bitbucket_config: Final = getattr(litellm_params, \"bitbucket_config\", None)\n    prompt_id: Final = getattr(litellm_params, \"prompt_id\", None)\n\n    if not bitbucket_config:\n        raise ValueError(\"bitbucket_config is required for BitBucket prompt integration\")\n\n    try:\n        bitbucket_prompt_manager: Final = BitBucketPromptManager(\n            bitbucket_config=bitbucket_config,\n            prompt_id=prompt_id,\n        )\n\n        return bitbucket_prompt_manager\n    except Exception as e:\n        raise e\n\n\nprompt_initializer_registry: Final = {\n    SupportedPromptIntegrations.BITBUCKET.value: prompt_initializer,\n}\n\n# Export public API\n__all__ = [","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/bitbucket/__init__.py#L23-L59","documentation":"The BitBucket prompt integration's prompt_initializer reads bitbucket_config from litellm_params via getattr; if it is absent or falsy it raises ValueError before constructing BitBucketPromptManager. bitbucket_config is a dict holding workspace, repository, access_token (and optionally branch, auth_method, username) and must be attached to the request's litellm_params.","triggerScenarios":"Configuring a BitBucket-hosted prompt model without a bitbucket_config block; passing bitbucket_config as None/empty dict; key misspelled (e.g. bitbucketCfg or nested one level too deep); config attached to the wrong level (model_settings instead of litellm_params).","commonSituations":"First-time setup following the prompts docs but omitting the config dict; proxy YAML indentation placing bitbucket_config under the wrong section; migration from another prompt integration where config lived elsewhere.","solutions":["Add bitbucket_config to litellm_params with at least workspace, repository, and access_token","Check spelling and nesting level — it must be exactly the key bitbucket_config readable by getattr on litellm_params","Pass prompt_id alongside the config so the manager knows which .prompt file to load","Verify the surrounding try/except did not swallow an earlier error from BitBucketPromptManager construction (the code re-raises as-is)"],"exampleFix":"# before\nlitellm_params = {\"model\": \"gpt-4o\"}  # no bitbucket_config -> ValueError\n\n# after\nlitellm_params = {\n    \"model\": \"gpt-4o\",\n    \"prompt_id\": \"my-prompt\",\n    \"bitbucket_config\": {\n        \"workspace\": \"my-workspace\",\n        \"repository\": \"my-repo\",\n        \"access_token\": \"<token>\",\n        \"branch\": \"main\",\n    },\n}","handlingStrategy":"validation","validationCode":"REQUIRED_BB_KEYS = (\"workspace\", \"repository\", \"access_token\")\n\ndef validate_bitbucket_config(params: dict) -> dict:\n    cfg = params.get(\"bitbucket_config\")\n    if not isinstance(cfg, dict) or not all(cfg.get(k) for k in REQUIRED_BB_KEYS):\n        raise ValueError(\"bitbucket_config must include workspace, repository, access_token\")\n    if not params.get(\"prompt_id\"):\n        raise ValueError(\"prompt_id is required for BitBucket prompts\")\n    return cfg","typeGuard":"def is_valid_bitbucket_config(cfg) -> bool:\n    return (\n        isinstance(cfg, dict)\n        and all(isinstance(cfg.get(k), str) and cfg[k].strip() for k in (\"workspace\", \"repository\", \"access_token\"))\n    )","tryCatchPattern":"try:\n    litellm.completion(**request_params)\nexcept ValueError as e:\n    if \"bitbucket_config is required\" in str(e):\n        raise ConfigError(\"Add bitbucket_config to this model's litellm_params\") from e\n    raise","preventionTips":["Validate bitbucket_config keys and prompt_id in one pre-flight function","Keep the config key name exact: bitbucket_config under litellm_params","In proxy YAML, lint the model entry for phoenix/bitbucket prompt models at deploy time"],"tags":["bitbucket","prompt-management","configuration","valueerror"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}