github/github-mcp-server · error

parameter %s could not be coerced to []int64, is %T

Error message

parameter %s could not be coerced to []int64, is %T

What it means

Returned by OptionalBigIntArrayParam's default branch when the parameter value is not nil, []string, or []any — the top-level shape is wrong for an int64-array parameter. Mirrors error 266 but for the BigInt array variant: any scalar or object where an array of numeric strings is expected.

Source

Thrown at pkg/github/params.go:341

		return []int64{}, nil
	case []string:
		return convertStringSliceToBigIntSlice(v)
	case []any:
		int64Slice := make([]int64, len(v))
		for i, v := range v {
			s, ok := v.(string)
			if !ok {
				return []int64{}, fmt.Errorf("parameter %s is not of type string, is %T", p, v)
			}
			val, err := convertStringToBigInt(s, 0)
			if err != nil {
				return []int64{}, fmt.Errorf("parameter %s: failed to convert element %d (%s) to int64: %w", p, i, s, err)
			}
			int64Slice[i] = val
		}
		return int64Slice, nil
	default:
		return []int64{}, fmt.Errorf("parameter %s could not be coerced to []int64, is %T", p, args[p])
	}
}

// WithPagination adds REST API pagination parameters to a tool.
// https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api
func WithPagination(schema *jsonschema.Schema) *jsonschema.Schema {
	schema.Properties["page"] = &jsonschema.Schema{
		Type:        "number",
		Description: "Page number for pagination (min 1)",
		Minimum:     jsonschema.Ptr(1.0),
	}

	schema.Properties["perPage"] = &jsonschema.Schema{
		Type:        "number",
		Description: "Results per page for pagination (min 1, max 100)",
		Minimum:     jsonschema.Ptr(1.0),
		Maximum:     jsonschema.Ptr(100.0),
	}

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Wrap values in a JSON array with quoted elements: ["123"]
  2. Split pre-joined strings client-side: strings.Split(ids, ",") then send as array
  3. Check the tool schema declares array of string items and let the client schema-validate before send

Example fix

// before
{"repository_ids":"123,456"}
// after
{"repository_ids":["123","456"]}
Defensive patterns

Strategy: validation

Validate before calling

func ensureArrayShape(args map[string]any, p string) error {
    switch args[p].(type) {
    case nil, []string, []any:
        return nil
    }
    return fmt.Errorf("%s must be a JSON array of numeric strings", p)
}

Type guard

func isCoercibleToBigIntArray(v any) bool {
    switch v.(type) {
    case nil, []string, []any:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Passing "123" instead of ["123"]; passing a JSON object keyed by index; passing an integer or boolean; sending a comma-joined string of IDs.

Common situations: Single-element convenience (users omit brackets); LLM collapsing arrays; clients serializing arrays via strings.Join before dispatch.

Related errors


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