github/github-mcp-server · error

owner not specified

Error message

owner not specified

What it means

Thrown by the list_repository_collaborators tool handler when deps.GetClient(ctx) fails before Repositories.ListCollaborators runs. In remote/server deployments (RequestDeps) the REST client is built per call from token info in the context plus configured API hosts, so the wrapped cause is 'no token info in context', 'failed to get base REST URL'/'failed to get upload URL', or 'failed to create REST client'. Stdio BaseDeps stores the client and cannot produce this error.

Source

Thrown at pkg/github/repository_resource_completions.go:127

	users, _, err := client.Search.Users(ctx, argValue, &github.SearchOptions{ListOptions: github.ListOptions{PerPage: 100 - len(values)}})
	if err != nil || users == nil {
		return nil, err
	}
	for _, user := range users.Users {
		values = append(values, user.GetLogin())
	}

	if len(values) > 100 {
		values = values[:100]
	}
	return values, nil
}

func completeRepo(ctx context.Context, client *github.Client, resolved map[string]string, argValue string) ([]string, error) {
	var values []string
	owner := resolved["owner"]
	if owner == "" {
		return values, errors.New("owner not specified")
	}

	query := fmt.Sprintf("org:%s", owner)

	if argValue != "" {
		query = fmt.Sprintf("%s %s", query, argValue)
	}
	repos, _, err := client.Search.Repositories(ctx, query, &github.SearchOptions{ListOptions: github.ListOptions{PerPage: 100}})
	if err != nil || repos == nil {
		return values, errors.New("failed to get repositories")
	}
	// filter repos based on argValue
	for _, repo := range repos.Repositories {
		name := repo.GetName()
		if argValue == "" || strings.HasPrefix(name, argValue) {
			values = append(values, name)
		}
	}

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Inspect the wrapped cause to route the fix (auth vs host config)
  2. Provide a valid token to the server process or incoming request
  3. Correct GITHUB_API_HOSTS / GITHUB_BASE_URL / GITHUB_UPLOAD_URL and restart
  4. Verify with an authenticated read like get_me before listing collaborators

Example fix

// before: no token reaches the handler
//   list_repository_collaborators -> "failed to get GitHub client: no token info in context"

// after
export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxxxxxxxxxxx
export GITHUB_API_HOSTS=api.github.com
Defensive patterns

Strategy: try-catch

Validate before calling

func preflightGitHubClient() error {
	if os.Getenv("GITHUB_PERSONAL_ACCESS_TOKEN") == "" {
		return fmt.Errorf("missing token: list_repository_collaborators cannot build a client")
	}
	return nil
}

Type guard

func isGitHubClientError(err error) bool {
	return err != nil && strings.Contains(err.Error(), "failed to get GitHub client")
}

Try / catch

result, _, err := callListRepositoryCollaborators(ctx, owner, repo)
if err != nil {
	if isGitHubClientError(err) {
		// auth/host config fault: fix env and restart; do not retry
		return fmt.Errorf("server auth/host misconfiguration: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Calling list_repository_collaborators when the context has no token info, when enterprise API host env vars are malformed so URL resolution fails, or when go-github rejects the configured enterprise URLs.

Common situations: Missing/expired GITHUB_PERSONAL_ACCESS_TOKEN; gateway stripping Authorization; enterprise URL misconfig; token lacking access to the target repository's collaborator listing.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/9931100e6e573a6a. Report an issue: GitHub.