github/github-mcp-server · error

parameter %s must not be empty

Error message

parameter %s must not be empty

What it means

Thrown by OptionalNullableStringParam in pkg/github/params.go when an explicitly present argument is the empty string. The helper preserves omitted and null as unset, but an empty string is rejected because GitHub would reject it as a bogus filter/type value. Affects the same nullable string fields (issue type, project filter, etc.).

Source

Thrown at pkg/github/params.go:52

	return
}

// OptionalNullableStringParam preserves omitted, null, and non-empty string values.
func OptionalNullableStringParam(args map[string]any, p string) (*string, bool, error) {
	value, ok := args[p]
	if !ok {
		return nil, false, nil
	}
	if value == nil {
		return nil, true, nil
	}

	stringValue, ok := value.(string)
	if !ok {
		return nil, true, fmt.Errorf("parameter %s is not of type string or null, is %T", p, value)
	}
	if stringValue == "" {
		return nil, true, fmt.Errorf("parameter %s must not be empty", p)
	}
	return &stringValue, true, nil
}

// isAcceptedError checks if the error is an accepted error.
func isAcceptedError(err error) bool {
	var acceptedError *github.AcceptedError
	return errors.As(err, &acceptedError)
}

// toInt converts a value to int, handling both float64 and string representations.
// Some MCP clients send numeric values as strings. It rejects NaN, ±Inf,
// fractional values, and values outside the int range.
func toInt(val any) (int, error) {
	var f float64
	switch v := val.(type) {
	case float64:
		f = v

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Omit the field entirely or send null instead of "".
  2. Fix client-side defaults: filter empty strings out of the arguments object before the call.
  3. If the value comes from a variable, guard with a conditional so the key is only set when the value is non-empty.

Example fix

// before
const args = { owner, repo, issue_number: 5, type: issueType ?? "" };
// after
const args = { owner, repo, issue_number: 5 };
if (issueType) args.type = issueType;
Defensive patterns

Strategy: validation

Validate before calling

function stripEmptyStrings(args) {
  for (const k of Object.keys(args)) {
    if (args[k] === "") delete args[k]; // omission == unset for nullable strings
  }
  return args;
}
// use before every tool call: stripEmptyStrings(arguments)

Try / catch

On /must not be empty/, delete the offending key (or set null) and retry; the call is otherwise valid.

Prevention

When it happens

Trigger: Passing type: "" or filter: "" to issue/project tools; templating code that builds arguments from empty variables (e.g. ${issueType} renders as ""); 'clear the value' attempts done by sending "" instead of null.

Common situations: Client code doing args.type = getValue() || ""; LLMs filling every schema field with empty strings; migration from an API where "" meant 'unset'.

Related errors


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