{"record":{"id":"fbb0e7ec48c2be8b","repo":"infiniflow/ragflow","slug":"found-no-repos-for-organization-self-repo-owner","errorCode":null,"errorMessage":"Found no repos for organization: {self.repo_owner}. Does the credential have the right scopes?","messagePattern":"Found no repos for organization: (.+?)\\. Does the credential have the right scopes\\?","errorType":"validation","errorClass":"ConnectorValidationError","httpStatus":null,"severity":"error","filePath":"common/data_source/github/connector.py","lineNumber":716,"sourceCode":"                            break\n                        except GithubException as e:\n                            validation_errors.append(f\"Repository '{repo_name}': {e.data.get('message', str(e))}\")\n\n                    if not valid_repos:\n                        error_msg = \"None of the specified repositories could be accessed: \"\n                        error_msg += \", \".join(validation_errors)\n                        raise ConnectorValidationError(error_msg)\n                else:\n                    # Single repository (backward compatibility)\n                    test_repo = self.github_client.get_repo(f\"{self.repo_owner}/{self.repositories}\")\n                    test_repo.get_contents(\"\")\n            else:\n                # Try to get organization first\n                try:\n                    org = self.github_client.get_organization(self.repo_owner)\n                    total_count = org.get_repos().totalCount\n                    if total_count == 0:\n                        raise ConnectorValidationError(f\"Found no repos for organization: {self.repo_owner}. Does the credential have the right scopes?\")\n                except GithubException as e:\n                    # Check for missing SSO\n                    MISSING_SSO_ERROR_MESSAGE = \"You must grant your Personal Access token access to this organization\".lower()\n                    if MISSING_SSO_ERROR_MESSAGE in str(e).lower():\n                        SSO_GUIDE_LINK = (\n                            \"https://docs.github.com/en/enterprise-cloud@latest/authentication/\"\n                            \"authenticating-with-saml-single-sign-on/\"\n                            \"authorizing-a-personal-access-token-for-use-with-saml-single-sign-on\"\n                        )\n                        raise ConnectorValidationError(\n                            f\"Your GitHub token is missing authorization to access the `{self.repo_owner}` organization. Please follow the guide to authorize your token: {SSO_GUIDE_LINK}\"\n                        )\n                    # If not an org, try as a user\n                    user = self.github_client.get_user(self.repo_owner)\n\n                    # Check if we can access any repos\n                    total_count = user.get_repos().totalCount\n                    if total_count == 0:","sourceCodeStart":698,"sourceCodeEnd":734,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/github/connector.py#L698-L734","documentation":"ConnectorValidationError raised when repositories is unset, repo_owner resolved to an organization (get_organization succeeded), but org.get_repos().totalCount == 0. The credential works yet sees zero repos, so the connector would index nothing. The message explicitly asks whether the credential has the right scopes.","triggerScenarios":"repo_owner is a valid org name, the token authenticates, but the token's scopes (e.g. a public-repo-only or wrong-org fine-grained PAT) expose no repositories, returning totalCount 0.","commonSituations":"Fine-grained PAT limited to 'public repos' of other orgs; classic token without 'repo' scope against a private-repo org; token belongs to a different org membership.","solutions":["Use a classic PAT with the 'repo' scope, or a fine-grained PAT with explicit access to that org's repositories (org owner must approve).","Confirm the token's user is a member of the org with repository read access.","Verify outside the app: gh api /orgs/<owner>/repos --jq length with the same token."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if gh.get_organization(owner).get_repos().totalCount == 0:\n    warn('token sees zero org repos — check scopes before saving')","typeGuard":null,"tryCatchPattern":"try:\n    connector.validate_connector_settings()\nexcept ConnectorValidationError as e:\n    guide_user_to_scope_fix(str(e))","preventionTips":["Issue tokens with the 'repo' scope when private org repos must be indexed.","Smoke-test the token with 'gh api /orgs/<owner>/repos' before wiring it into the connector."],"tags":["github","permissions","scopes","organization","validation"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}