{"record":{"id":"6eb15ec228a0a670","repo":"infiniflow/ragflow","slug":"gitlab","errorCode":null,"errorMessage":"GitLab","messagePattern":"GitLab","errorType":"validation","errorClass":"ConnectorMissingCredentialError","httpStatus":null,"severity":"error","filePath":"common/data_source/gitlab_connector.py","lineNumber":185,"sourceCode":"        include_issues: bool = True,\n        include_code_files: bool = False,\n    ) -> None:\n        self.project_owner = project_owner\n        self.project_name = project_name\n        self.batch_size = batch_size\n        self.state_filter = state_filter\n        self.include_mrs = include_mrs\n        self.include_issues = include_issues\n        self.include_code_files = include_code_files\n        self.gitlab_client: gitlab.Gitlab | None = None\n\n    def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:\n        self.gitlab_client = gitlab.Gitlab(credentials[\"gitlab_url\"], private_token=credentials[\"gitlab_access_token\"])\n        return None\n\n    def validate_connector_settings(self) -> None:\n        if self.gitlab_client is None:\n            raise ConnectorMissingCredentialError(\"GitLab\")\n\n        try:\n            self.gitlab_client.auth()\n            self.gitlab_client.projects.get(\n                f\"{self.project_owner}/{self.project_name}\",\n                lazy=True,\n            )\n\n        except gitlab.exceptions.GitlabAuthenticationError as e:\n            raise CredentialExpiredError(\"Invalid or expired GitLab credentials.\") from e\n\n        except gitlab.exceptions.GitlabAuthorizationError as e:\n            raise InsufficientPermissionsError(\"Insufficient permissions to access GitLab resources.\") from e\n\n        except gitlab.exceptions.GitlabGetError as e:\n            raise ConnectorValidationError(\"GitLab project not found or not accessible.\") from e\n\n        except Exception as e:","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/gitlab_connector.py#L167-L203","documentation":"ConnectorMissingCredentialError('GitLab') raised at the top of the GitLab connector's validate_connector_settings() when self.gitlab_client is None. The client is built only in load_credentials(), which requires both 'gitlab_url' and 'gitlab_access_token' keys; if validation runs first, this error fires before any GitLab request (auth() is the next step).","triggerScenarios":"Calling validate_connector_settings() on a GitLabConnector whose load_credentials({'gitlab_url': ..., 'gitlab_access_token': ...}) was never invoked — e.g. credential payload missing or skipped during connector setup.","commonSituations":"Saving a GitLab credential with a blank token; orchestration constructing the connector but not loading credentials before the validation hook; KeyError in load_credentials (missing key) leaving gitlab_client None.","solutions":["Provide both gitlab_url and gitlab_access_token and call load_credentials() before validate_connector_settings().","Ensure the credential dict contains both keys — load_credentials indexes them directly and a missing key aborts client construction.","For self-hosted GitLab, double-check gitlab_url points at the instance root (e.g. https://gitlab.example.com)."],"exampleFix":"// before\nconnector = GitlabConnector(...)\nconnector.validate_connector_settings()  # raises ConnectorMissingCredentialError('GitLab')\n\n# after\nconnector = GitlabConnector(...)\nconnector.load_credentials({'gitlab_url': 'https://gitlab.com', 'gitlab_access_token': token})\nconnector.validate_connector_settings()","handlingStrategy":"validation","validationCode":"if connector.gitlab_client is None:\n    connector.load_credentials({\n        'gitlab_url': os.environ['GITLAB_URL'],\n        'gitlab_access_token': os.environ['GITLAB_TOKEN'],\n    })","typeGuard":"def gitlab_ready(c: GitlabConnector) -> bool:\n    return c.gitlab_client is not None","tryCatchPattern":"try:\n    connector.validate_connector_settings()\nexcept ConnectorMissingCredentialError:\n    show_credential_form('GitLab')","preventionTips":["Supply both gitlab_url and gitlab_access_token keys — load_credentials indexes them directly and any missing key prevents client construction.","Validate credential payload shape at the API boundary before connector construction."],"tags":["gitlab","credentials","validation"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}