github/github-mcp-server · warning

owner or repo not specified

Error message

owner or repo not specified

What it means

Thrown by the 'branch' argument completion handler (completeBranch) when the MCP completion request's resolved context lacks 'owner' or 'repo'. Completions are chained: the client resolves earlier URI segments (owner, then repo) and passes them via req.Params.Context.Arguments; if either is missing/empty, branch completion cannot proceed and errors immediately.

Source

Thrown at pkg/github/repository_resource_completions.go:155

		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)
		}
	}

	return values, nil
}

func completeBranch(ctx context.Context, client *github.Client, resolved map[string]string, argValue string) ([]string, error) {
	var values []string
	owner := resolved["owner"]
	repo := resolved["repo"]
	if owner == "" || repo == "" {
		return values, errors.New("owner or repo not specified")
	}
	branches, _, _ := client.Repositories.ListBranches(ctx, owner, repo, nil)

	for _, branch := range branches {
		if argValue == "" || strings.HasPrefix(branch.GetName(), argValue) {
			values = append(values, branch.GetName())
		}
	}
	if len(values) > 100 {
		values = values[:100]
	}
	return values, nil
}

func completeSHA(ctx context.Context, client *github.Client, resolved map[string]string, argValue string) ([]string, error) {
	var values []string
	owner := resolved["owner"]
	repo := resolved["repo"]

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Complete the URI segments in order: resolve 'owner' first, then 'repo', then request 'branch' completions with both values in the context arguments
  2. On the client, always include previously resolved argument values in the completion request's context (req.Params.Context.Arguments)
  3. If writing a custom handler, degrade gracefully: return empty values instead of an error when owner/repo are absent

Example fix

// before (handler errors out)
if owner == "" || repo == "" {
    return values, errors.New("owner or repo not specified")
}

// after (degrade to empty completion instead of failing the MCP request)
if owner == "" || repo == "" {
    return nil, nil // no suggestions until owner/repo are resolved
}
Defensive patterns

Strategy: validation

Validate before calling

// Client-side: only request branch completions once owner+repo are resolved
if ctxArgs["owner"] == "" || ctxArgs["repo"] == "" {
    // resolve owner, then repo first; skip branch completion for now
    return nil
}
req := &mcp.CompleteRequest{Params: mcp.CompleteParams{
    Ref: mcp.Ref{Type: "ref/resource", URI: repoTemplateURI},
    Argument: mcp.Argument{Name: "branch", Value: partial},
    Context: &mcp.Context{Arguments: ctxArgs}, // includes owner+repo
}}

Try / catch

// Server-side hardening: treat missing prerequisites as empty completion
if owner == "" || repo == "" {
    return &mcp.CompleteResult{Completion: mcp.CompletionResultDetails{Values: []string{}}}, nil
}

Prevention

When it happens

Trigger: A completion request for argument 'branch' where resolved["owner"] == "" or resolved["repo"] == "" — e.g. the client jumps straight to completing the branch segment of the repository resource URI without first resolving owner and repo, or passes an empty Arguments context.

Common situations: MCP client implementations that complete each URI segment independently without sending prior segment values; testing the completion handler directly with an empty resolved map; URI templates whose earlier parameters have different names than 'owner'/'repo'.

Related errors


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