cilium/cilium · error

invalid repository format. Expected 'owner/repo', got '%s'

Error message

invalid repository format. Expected 'owner/repo', got '%s'

What it means

The --repo parameter must be exactly 'owner/repo'. `downloadWorkflowData` splits `s.params.Repo` on "/" and, if it doesn't yield exactly two parts, rejects it with this message before creating the GitHub client.

Source

Thrown at cilium-cli/features/summary.go:57

	}

	workflowData, err := loadWorkflowData(s.params.MetricsDirectory)
	if err != nil {
		return err
	}
	return s.printSummaryFromJsons(workflowData)
}

func (s *Feature) downloadWorkflowData(ctx context.Context) error {
	token := os.Getenv("GITHUB_TOKEN")

	if token == "" {
		return fmt.Errorf("GITHUB_TOKEN environment variable must be set.")
	}

	parts := strings.Split(s.params.Repo, "/")
	if len(parts) != 2 {
		return fmt.Errorf("invalid repository format. Expected 'owner/repo', got '%s'", s.params.Repo)
	}
	owner, repoName := parts[0], parts[1]

	ghClient, err := github.NewClient(github.WithAuthToken(token))
	if err != nil {
		return fmt.Errorf("creating github client: %w", err)
	}

	allRuns := map[int64]*github.WorkflowRun{}
	// Fetch workflow runs for the specific commit
	for _, event := range []string{"push", "schedule", "pull_request", "pull_request_target"} {
		opts := &github.ListWorkflowRunsOptions{
			HeadSHA: s.params.Commit,
			Status:  "completed",
			Event:   event,
			ListOptions: github.ListOptions{
				PerPage: 100,
			},

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Pass `--repo cilium/cilium` (bare owner/repo, no URL, no extra path)
  2. Strip protocol/prefix if deriving from a URL: use path portion only
  3. Validate the flag value in your wrapper script before invoking cilium-cli

Example fix

// before
--repo https://github.com/cilium/cilium
// after
--repo cilium/cilium
Defensive patterns

Strategy: validation

Validate before calling

func normalizeRepo(r string) (string, error) {
	r = strings.TrimPrefix(r, "https://github.com/")
	r = strings.TrimPrefix(r, "github.com/")
	parts := strings.Split(strings.Trim(r, "/"), "/")
	if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
		return "", fmt.Errorf("repo must be owner/repo, got %q", r)
	}
	return parts[0] + "/" + parts[1], nil
}

Type guard

func isOwnerRepoFormat(s string) bool {
	parts := strings.Split(s, "/")
	return len(parts) == 2 && parts[0] != "" && parts[1] != ""
}

Try / catch

if err := feat.GenSummary(ctx); err != nil {
	if strings.Contains(err.Error(), "invalid repository format") {
		normalized, nerr := normalizeRepo(flagRepo)
		if nerr == nil { return rerunWithRepo(normalized) }
	}
	return err
}

Prevention

When it happens

Trigger: `strings.Split(s.params.Repo, "/")` returns != 2 parts: e.g. "cilium", "https://github.com/cilium/cilium", "cilium/cilium/extra", or empty string.

Common situations: Users pass a full URL instead of owner/repo, omit the flag so it defaults empty, or pass org/repo/branch.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/3128646ca23fbcee. Report an issue: GitHub.