{"record":{"id":"fa7f2f638e85ddd9","repo":"github/github-mcp-server","slug":"parameter-s-is-not-of-type-string-or-null-is-t","errorCode":null,"errorMessage":"parameter %s is not of type string or null, is %T","messagePattern":"parameter (.+?) is not of type string or null, is %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/params.go","lineNumber":49,"sourceCode":"\n\t// Present and correct type\n\tok = true\n\treturn\n}\n\n// OptionalNullableStringParam preserves omitted, null, and non-empty string values.\nfunc OptionalNullableStringParam(args map[string]any, p string) (*string, bool, error) {\n\tvalue, ok := args[p]\n\tif !ok {\n\t\treturn nil, false, nil\n\t}\n\tif value == nil {\n\t\treturn nil, true, nil\n\t}\n\n\tstringValue, ok := value.(string)\n\tif !ok {\n\t\treturn nil, true, fmt.Errorf(\"parameter %s is not of type string or null, is %T\", p, value)\n\t}\n\tif stringValue == \"\" {\n\t\treturn nil, true, fmt.Errorf(\"parameter %s must not be empty\", p)\n\t}\n\treturn &stringValue, true, nil\n}\n\n// isAcceptedError checks if the error is an accepted error.\nfunc isAcceptedError(err error) bool {\n\tvar acceptedError *github.AcceptedError\n\treturn errors.As(err, &acceptedError)\n}\n\n// toInt converts a value to int, handling both float64 and string representations.\n// Some MCP clients send numeric values as strings. It rejects NaN, ±Inf,\n// fractional values, and values outside the int range.\nfunc toInt(val any) (int, error) {\n\tvar f float64","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/params.go#L31-L67","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\narguments: { owner, repo, issue_number: 5, type: [\"Bug\"] }\n// after\narguments: { owner, repo, issue_number: 5, type: \"Bug\" }","handlingStrategy":"type-guard","validationCode":"function checkNullableString(args, name) {\n  const v = args[name];\n  if (v === undefined || v === null || typeof v === \"string\") return;\n  throw new Error(`${name} must be a string or null, got ${typeof v}`);\n}","typeGuard":"function isNullableString(v: unknown): v is string | null | undefined {\n  return v === undefined || v === null || typeof v === \"string\";\n}","tryCatchPattern":"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.","preventionTips":["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]."],"tags":["validation","type-mismatch","nullable","argument-parsing","mcp-tool"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}