github/github-mcp-server · error

%s must be a non-empty string

Error message

%s must be a non-empty string

What it means

Raised by stringFromEntry (pkg/github/projects_batch.go:464) when item_owner or item_repo exists but its value is not a non-empty string — i.e. it is null, a number, a bool, an array, or "". It is wrapped into the 'must all be provided together' message by parseItemRef and the item is rejected before any API call.

Source

Thrown at pkg/github/projects_batch.go:464

	for _, key := range []string{"node_id", "item_id", "item_owner", "item_repo", "issue_number"} {
		if v, ok := entry[key]; ok {
			ref[key] = v
		}
	}
	if len(ref) == 0 {
		return nil
	}
	return ref
}

func stringFromEntry(entry map[string]any, key string) (string, error) {
	v, ok := entry[key]
	if !ok {
		return "", fmt.Errorf("missing %s", key)
	}
	s, ok := v.(string)
	if !ok || s == "" {
		return "", fmt.Errorf("%s must be a non-empty string", key)
	}
	return s, nil
}

func intFromEntry(entry map[string]any, key string) (int, error) {
	v, ok := entry[key]
	if !ok {
		return 0, fmt.Errorf("missing %s", key)
	}
	n, err := validatePositiveInt64(v)
	if err != nil {
		return 0, fmt.Errorf("%s must be a positive integer: %w", key, err)
	}
	if n > math.MaxInt32 {
		return 0, fmt.Errorf("%s exceeds the GraphQL Int maximum of %d", key, int64(math.MaxInt32))
	}
	return int(n), nil
}

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Ensure item_owner and item_repo are non-empty strings (GitHub slugs, e.g. "octocat" and "hello-world")
  2. Filter or fix rows whose owner/repo is null or empty before building the batch
  3. Convert non-string sources to strings explicitly at the boundary
  4. Note null is not treated as missing — remove the key entirely if you want the 'missing' path, but either way the item needs a real value

Example fix

// before
{"item_owner": null, "item_repo": "repo", "issue_number": 7}
// after
{"item_owner": "octocat", "item_repo": "repo", "issue_number": 7}
Defensive patterns

Strategy: validation

Validate before calling

for _, k := range []string{"item_owner", "item_repo"} {
	s, ok := entry[k].(string)
	if !ok || s == "" {
		return fmt.Errorf("%s must be a non-empty string", k)
	}
}

Type guard

func isNonEmptyString(v any) bool { s, ok := v.(string); return ok && s != "" }

Prevention

When it happens

Trigger: {"item_owner": null, "item_repo":"repo", "issue_number":7}, {"item_owner": ""} from a blank template expansion, or {"item_repo": 12345} when a numeric org/repo field is forwarded unconverted.

Common situations: Upstream serializers that emit explicit nulls for missing columns; templating that renders empty strings; owner/repo stored as numeric codes in an internal DB and passed through without mapping to the slug.

Related errors


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