github/github-mcp-server · error
parameter %s is not of type string or null, is %T
Error message
parameter %s is not of type string or null, is %T
What it means
Thrown by OptionalNullableStringParam in pkg/github/params.go when an argument that must be a string or JSON null is present but has another type. Used for nullable string fields such as issue "type", project "filter", or "issue_type" in issues.go/issues_granular.go/projects.go. Omitted and null are both fine; only non-string non-null values fail.
Source
Thrown at pkg/github/params.go:49
// Present and correct type
ok = true
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 float64View on GitHub (pinned to 0ea1f775a7)
Solutions
- Send the argument as a plain JSON string (e.g. "type": "Bug") or as null.
- Drop the argument completely if you want the field unset — omission is treated the same as null.
- If you meant to set several values, check the tool schema: this field is single-valued; find the corresponding array-typed field instead.
- Verify with the tool's inputSchema which fields are "type": ["string","null"] before building arguments.
Example fix
// before
arguments: { owner, repo, issue_number: 5, type: ["Bug"] }
// after
arguments: { owner, repo, issue_number: 5, type: "Bug" } Defensive patterns
Strategy: type-guard
Validate before calling
function checkNullableString(args, name) {
const v = args[name];
if (v === undefined || v === null || typeof v === "string") return;
throw new Error(`${name} must be a string or null, got ${typeof v}`);
} Type guard
function isNullableString(v: unknown): v is string | null | undefined {
return v === undefined || v === null || typeof v === "string";
} Try / catch
On an error result matching /is not of type string or null/, unwrap arrays to their single element or stringify the value, then retry once with the corrected type.
Prevention
- Unwrap [x] arrays before assigning to single-value fields.
- Treat 'omit' and null as equivalent unset signals in your client conventions.
- Add schema validation for fields declared type: [string, null].
When it happens
Trigger: Passing an array (e.g. type: ["Bug"]) or a number/boolean (e.g. type: 1) where a nullable string like issue type or project filter is expected; sending an object because the field was confused with a nested schema.
Common situations: LLM-generated arguments that wrap single values in arrays; confusing a single-value filter field with a multi-value field; client serializers that convert null to {} or omit-vs-null mistakes; upgrading a field from list to single value or vice versa.
Related errors
- parameter %s is not of type %T, is %T
- parameter %s must not be empty
- expected number, got %T
- parameter %s is not of type %T
- invalid detail %q: must be one of "none", "stats", "full_pat
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/fa7f2f638e85ddd9.
Report an issue: GitHub.